Tom Lane wrote:
> I assume you mean static as in not-auto, rather than static as in
> not-global. Otherwise we have a problem here.
> Surely the addresses can be assumed constant within a thread. Otherwise
> we have a problem here too.
>>Taking addresses of TLS variables should be considered illegal,
> Sorry, no can accept that restriction.
I think you are okay on all 3 fronts,
from http://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html#Thread-Local :
"The __thread specifier may be used alone, with the extern or static
specifiers, but with no other storage class specifier. When used with
extern or static, __thread must appear immediately after the other
storage class specifier."
"When the address-of operator is applied to a thread-local variable, it
is evaluated at run-time and returns the address of the current thread's
instance of that variable. An address so obtained may be used by any
thread. When a thread terminates, any pointers to thread-local variables
in that thread become invalid."
Also see "ISO/IEC 9899:1999 Edits for Thread-Local Storage" :
and ELF Handling For Thread-Local Storage,
http://people.redhat.com/drepper/tls.pdf may be of interest.
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2003-09-26 04:14:32|
|Subject: Re: Error message cleanup |
|Previous:||From: Christopher Kings-Lynne||Date: 2003-09-26 03:22:25|
|Subject: feature request: show pgsql version when running initdb|
pgsql-hackers-win32 by date
|Next:||From: Zeugswetter Andreas SB SD||Date: 2003-09-26 08:53:14|
|Subject: Re: [HACKERS] Threads vs Processes|
|Previous:||From: Myron Scott||Date: 2003-09-25 23:19:21|
|Subject: Re: Threads vs Processes |