Snort mailing list archives

THREAD_LOCAL


From: Sancho Panza <sancho () posteo de>
Date: Fri, 23 Jan 2015 16:26:14 +0100

I am currently working myself through the source code of Snort++ 
3.0.0-a1-130.
I saw that there are quite a few variables are declared to be 
"THREAD_LOCAL", for example

THREAD_LOCAL SnortConfig* snort_conf = nullptr;

Alas, this is only just a pointer, and I believe, that as soon as space 
is allocated for that variable during parsing and initialisation, the 
assignments made thereto are made with memory allocated on a per-process 
level, not on a per-thread level.
Is this correct or am I missing something?
If I'm right, then what's the point of declaring snort_conf 
THREAD_LOCAL?

Suppose I want to write my own rule detection option MyOption (inhering 
from IpsOption), is it safe to declare member variables inside MyOption 
and modify those during eval() without having to fear the threads might 
get in each others way, i.e. does every thread have its own instances of 
every IpsOption?

Many thanks

Sancho

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Snort-devel mailing list
Snort-devel () lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/snort-devel
Archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-devel

Please visit http://blog.snort.org for the latest news about Snort!


Current thread: