http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/gcc/Thread_002dLocal.html
Documents __thread
yet my g++ complains that __thread is not supported on my arch (Leopard on Macbookpro).
Why is this? And how do I get around it?
...
__thread Foo foo;
How is "foo" actually resolved? Does the compiler silently replace every instance of "foo" with a function call? Is "foo" stored somewhere relative to the bottom of the stack, and the compiler stores this as "hey, for each thread, have this space near the bottom of the stack, and foo is stored as 'offset x from bottom...
I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens.
Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it...
Trying to run a C++ program, I get segmentation
faults which appear to be specific to NetBSD. Bert Hubert wrote the
simple test program (at the end of this message) and, indeed, it crashes only on NetBSD.
% uname -a
NetBSD golgoth 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Oct 1 15:46:16 CEST 2009
+stephane@golgoth:/usr/obj/sys/arch/i386/com...
I'm learning about Thread Local Storage... (TLS)
Here is my TLS Alloc code:
//global variable
DWORD g_dwTlsIndex;
//inside DLLMain:
int val= 5;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_dwTlsIndex = TlsAlloc();
if ((g_dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES)
{
printf("No more indexes available");
}
...
I need to make use of thread-local storage in a cross-platform project. Under *IX I am using pthreads and can avoid memory leaks thanks to the nice destructor function pointer passed as the second argument to pthread_key_create, but in Windows TlsAlloc has no such thing. Nor can I find a general place where any function is called on thre...
Running splint
matt@stanley:~/cpfs$ splint -paramuse +gnuextensions cpfs.c
Halts on this line:
__thread int cpfs_errno;
With a parse error:
cpfs.c:127:13: Parse Error: Non-function declaration: __thread :
int. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.
Checking the documentatio...
I have a code-base of legacy C/C++ code, which contains lots of functions that access global static variables, and are therefore not thread-safe. I'm looking for advice on how to convert this code to make it thread safe. It occurs to me that one way to do it would be to convert the static variables into thread-local variables, or otherwi...
How does c++ complier implement thread local storage in C++0x
I have searched this in google. But I can't find anything about this.
Does anyone have any material about this ??
...
log4net provides two different "thread context" objects: ThreadContext and LogicalThreadContext, each of which has a property bag, Properties. ThreadContext has a ThreadContextProperties bag while LogicalThreadContext has a LogicalThreadContextProperties bag.
ThreadContext is perhaps more commonly known as "MDC".
LogicalContext is per...