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

Re: [HACKERS] Threads vs Processes

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <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-25 19:48:43
Message-ID: 303E00EBDD07B943924382E153890E5434A9E0@cuthbert.rcsinc.local (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32
Both Microsoft and windows compilers support thread local storage.  *If*
you guys go with the threading model and *if* it does not introduce any
serious portability issues with gcc (big ifs, and I'm not familiar with
gcc), than IMO TLS is really the way to go.  I don't think any
reorganization of postgres's static variables is necessary.  TLS is
implemented in the win32 API, not the C Libs, so by giving up the syntax
sugar you can make direct calls and keep compiler independence in win32.

Microsoft syntax is __desclspec(thread) and Borland syntax is simply
__thread.  All TLS variables *must* be static (or implicitly static
through extern, i.e. no 'auto' variables) and their addresses can not be
assumed to be constant.  

Taking addresses of TLS variables should be considered illegal, as well
as pointers to TLS variables.  Another gotcha is that DLLs that have
__thread variables will GPF if loaded with LoadLibrary (they should be
static linked).  Of course, pg does not use dlls, but it's worth noting.



pgsql-hackers by date

Next:From: Tom LaneDate: 2003-09-25 19:52:11
Subject: Re: pgsql procedures??
Previous:From: Tom LaneDate: 2003-09-25 19:41:49
Subject: pgsql-server/src/backend/executor execScan.c

pgsql-hackers-win32 by date

Next:From: Keith BottnerDate: 2003-09-25 20:03:57
Subject: Re: [HACKERS] Threads vs Processes
Previous:From: Keith BottnerDate: 2003-09-25 19:16:24
Subject: Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for windows)

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