From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | DANTE Alexandra <Alexandra(dot)Dante(at)bull(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Aim of --enable-thread-safety ? |
Date: | 2006-07-10 10:05:28 |
Message-ID: | 20060710100528.GC17723@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2006-07-10 10:31:09 | Re: Is OpenFTS dead? |
Previous Message | Vladimir A. Petrov | 2006-07-10 09:56:32 | How to restrict select from table with external validation? |