Re: [HACKERS] Threads vs Processes
- From: Kurt at DBC <kurtw(at)dbc(dot)co(dot)nz>
- To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
- Cc: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>, Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>
- Subject: Re: [HACKERS] Threads vs Processes
- Date: Fri, 26 Sep 2003 15:52:11 +1200
- Message-id: <3F73B7EB(dot)2000901(at)dbc(dot)co(dot)nz>
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."
and
"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" :
http://gcc.gnu.org/onlinedocs/gcc/C99-Thread-Local-Edits.html#C99%20Thread-Local%20Edits
and ELF Handling For Thread-Local Storage,
http://people.redhat.com/drepper/tls.pdf may be of interest.
Cheers,
Kurt.
Home |
Main Index |
Thread Index