Skip site navigation (1) Skip section navigation (2)

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: 2003-09-26 03:52:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32
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 :

"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, may be of interest.


In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2003-09-26 04:14:32
Subject: Re: Error message cleanup
Previous:From: Christopher Kings-LynneDate: 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 SDDate: 2003-09-26 08:53:14
Subject: Re: [HACKERS] Threads vs Processes
Previous:From: Myron ScottDate: 2003-09-25 23:19:21
Subject: Re: Threads vs Processes

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group