Mail Archives: cygwin/1997/06/04/23:26:36
I saw somewhere in this lists archives:
#define THREADLOCAL __attribute__((section(".tls")))
int foo THREADLOCAL = 42;
which looks like it will place the variable in the .tls section,
and NT will create a .tls data area for each thread.
It looks like my "old" compiler generates something close to
the following pseudo-reference:
(*(tls ***)(fs:0x2c))[tls_index]->foo
where _tls_index looks like a global variable, 0x2c is a "well known"
offset into the fs selector(?), tls is a pseudo-structure which is
dependent on link order, and foo is an offset into tls.
this expression is put in automatically for __declspec(thread) vars,
and can be used as an lval or rval.
I would love to have a macro to put around all uses of a tls
var to generate something like this. It doesn't need to be
hidden for now.
Is there a better way to solve the broken process model problem
(other than reorganizing gobs of old code?)
Thanks for looking at it! James AT bellhow DOT com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -