Re: Aim of --enable-thread-safety ?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Aim of --enable-thread-safety ?
Дата
Msg-id 20060710100528.GC17723@svana.org
обсуждение исходный текст
Ответ на Aim of --enable-thread-safety ?  (DANTE Alexandra <Alexandra.Dante@bull.net>)
Ответы Re: Aim of --enable-thread-safety ?
Список pgsql-general
On Mon, Jul 10, 2006 at 11:47:06AM +0200, DANTE Alexandra wrote:
> Hello List,
>
> I wonder if this compilation option is really taken into account as
> PostgreSQL is not multi-threading but multi-processing.
> I have read that without this option, the libpq won't know anything
> about threads and may indeed have problems, but could you explain me how
> this option runs ?

It enables thread-safety in client libraries. If you don't do this then
the client libraries will behave strangly when used in multi-threaded
programs.

As an example, consider the "errno" variable. It's a global variable,
which obviously doesn't work well in multi-threaded programs. When you
enable thread-safety it becomes a thread-local variable. The C library
has a number of things like that (locale, timezone, strtok, etc).

In modern systems it should always be on for libraries. There's is no
way to guarentee your library won't be used in a multithreaded program
and the cost is marginal. Really, the option should be changed to
default to on.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: DANTE Alexandra
Дата:
Сообщение: Aim of --enable-thread-safety ?
Следующее
От: "Vladimir A. Petrov"
Дата:
Сообщение: How to restrict select from table with external validation?