Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...
Дата
Msg-id 15901.37971.681172.613637@kelvin.csl.co.uk
обсуждение исходный текст
Ответ на Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom,

Tom Lane writes:
 > Lee Kindness <lkindness@csl.co.uk> writes:
 > > + #define _THREAD_SAFE
 > > + #define _REENTRANT
 > > + #define _POSIX_PTHREAD_SEMANTICS
 > What is this stuff, and why isn't it wrapped in any sort of
 > platform-specific test?  If it's needed, why is it in only one .c
 > file?

It's actually in libpq-int.h too... The correct way for this is to
compile with the compilers specific thread flags, however the downside
to this has already been discussed. Depending on the system one, or a
combination of those flags will turn on some magic such as errno being
a function call rather than a global variable. This is needed to make
the library thread safe.

On a second look libpq-int.h isn't the best place for this (hence it
also appears in one of the C files), it needs to be done in each C
file before any of the system headers are included - a libpq-threads.h
header? Would this be ok?

Do do things 100% right we'd need to detect compiler thread flags and
compile with them...

 > Also, haven't you broken SOCK_STRERROR for the Windows case?

Sorry, I seem to have forgotton to update the prototype in win32.h to
match the updated function. Updated diff attached (and online).

Lee.


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: more adequate usage msg: pg_controldata.diff