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

From: DANTE Alexandra <Alexandra(dot)Dante(at)bull(dot)net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Aim of --enable-thread-safety ?
Date: 2006-07-10 12:44:05
Message-ID: 44B24B95.8010207@bull.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Martijn,

Thank you for your answer.
Just to be sure, the "--enable-thread-safety" option allows client
libraries, which connect via libpq to a PostgreSQL database, to be
multi-threaded, but each "postgres" process launched to etablish the
connection is not multi-threaded. Consequently, PostgreSQL can not
execute a query in several CPU, the source code of PostgreSQL is not
multi-threaded.

Is it correct ?

Thank you very much for your help.

Regards,
Alexandra

Martijn van Oosterhout wrote:

>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,
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2006-07-10 12:54:59 Re: Aim of --enable-thread-safety ?
Previous Message Stephane Bortzmeyer 2006-07-10 12:31:53 Re: Version/Change Management of functions?