libpy and ENABLE_THREAD_SAFETY=1

Started by Pit M.over 20 years ago6 messagesgeneral
Jump to latest
#1Pit M.
fmi-soft@gmx.de

Is the standard libpq.dll distributed by PostgreSQL8.0 for windows
thread safe by default ?

Pit

#2Magnus Hagander
magnus@hagander.net
In reply to: Pit M. (#1)
Re: libpy and ENABLE_THREAD_SAFETY=1

Is the standard libpq.dll distributed by PostgreSQL8.0 for
windows thread safe by default ?

No.
It is safe as long as you use each PGconn on a separate thread but you
cannot share the same PGconn between threads.

//Magnus

#3Pit M.
fmi-soft@gmx.de
In reply to: Magnus Hagander (#2)
Re: libpy and ENABLE_THREAD_SAFETY=1

Magnus Hagander wrote:

Is the standard libpq.dll distributed by PostgreSQL8.0 for
windows thread safe by default ?

No.
It is safe as long as you use each PGconn on a separate thread but you
cannot share the same PGconn between threads.

//Magnus

But what if I compile the DLL using ENABLE_THREAD_SAFETY ?
Can I then use one connection for multiple threads ?

Pit

#4Magnus Hagander
magnus@hagander.net
In reply to: Pit M. (#3)
Re: libpy and ENABLE_THREAD_SAFETY=1

Is the standard libpq.dll distributed by PostgreSQL8.0 for windows
thread safe by default ?

No.
It is safe as long as you use each PGconn on a separate

thread but you

cannot share the same PGconn between threads.

//Magnus

But what if I compile the DLL using ENABLE_THREAD_SAFETY ?
Can I then use one connection for multiple threads ?

In theory, but I beleive there are build issues in the currently
released version when it comes to building on win32 with
ENABLE_THREAD_SAFETY.

//Magnus

#5Pit M.
fmi-soft@gmx.de
In reply to: Magnus Hagander (#4)
Re: libpy and ENABLE_THREAD_SAFETY=1

Magnus Hagander wrote:

Is the standard libpq.dll distributed by PostgreSQL8.0 for windows
thread safe by default ?

No.
It is safe as long as you use each PGconn on a separate

thread but you

cannot share the same PGconn between threads.

//Magnus

But what if I compile the DLL using ENABLE_THREAD_SAFETY ?
Can I then use one connection for multiple threads ?

In theory, but I beleive there are build issues in the currently
released version when it comes to building on win32 with
ENABLE_THREAD_SAFETY.

//Magnus

Thank you for this information.

Your wrote: "In theory"
Do you know anybody who has tested this ?
I mean a person of the PostgreSQL core team.

Pit

#6Magnus Hagander
magnus@hagander.net
In reply to: Pit M. (#5)
Re: libpy and ENABLE_THREAD_SAFETY=1

In theory, but I beleive there are build issues in the currently
released version when it comes to building on win32 with
ENABLE_THREAD_SAFETY.

//Magnus

Thank you for this information.

Your wrote: "In theory"
Do you know anybody who has tested this ?
I mean a person of the PostgreSQL core team.

Nope. I know Dave Page has been working on it (he's not core, but I'd
call him "core pg-win32" if such a term existed), but I'm unsure of
wether he has finished yet.

//Magnus