Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux