Re: [pgsql-hackers-win32] Threads vs Processes

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: [pgsql-hackers-win32] Threads vs Processes
Дата
Msg-id 303E00EBDD07B943924382E153890E5434A9E2@cuthbert.rcsinc.local
обсуждение исходный текст
Ответы Re: [pgsql-hackers-win32] Threads vs Processes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:
>> All TLS variables *must* be static (or implicitly static
>> through extern, i.e. no 'auto' variables)

>I assume you mean static as in not-auto, rather than static as in
>not-global.  Otherwise we have a problem here.

Yes, you are correct.

>> and their addresses can not be
>> assumed to be constant.

>Surely the addresses can be assumed constant within a thread.
Otherwise
>we have a problem here too.

Quoting from the MSDN:
The address of a thread local object is not considered constant, and any
expression involving such an address is not considered a constant
expression. In standard C, the effect of this is to forbid the use of
the address of a thread local variable as an initializer for an object
or pointer. For example, the following code will be flagged as an error
by the C compiler:
#define Thread  __declspec( thread )
Thread int tls_i;
int *p = &tls_i;        //This will generate an error in C.
<end>

(Note this does not apply to C++)


>> Taking addresses of TLS variables should be considered illegal,

>Sorry, no can accept that restriction.

I thought not.  I believe if TLS variables are detail managed through
the win32 API, some of these problems can be avoided (after all, these
examples are for the Microsoft compiler).

Merlin



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Sailesh Krishnamurthy
Дата:
Сообщение: Re: PostgreSQL not ACID compliant?
Следующее
От: Shridhar Daithankar
Дата:
Сообщение: Re: Threads vs Processes