Re: libpq_r

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема Re: libpq_r
Дата
Msg-id 16159.56100.627252.999417@kelvin.csl.co.uk
обсуждение исходный текст
Ответ на Re: libpq_r  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: libpq_r  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Bruce Momjian writes:> Lee Kindness wrote:> > Guys, take a look at what was done in libpq to make it> > thread-safe...
Nolocks! No overheaded - just using "proper" reentrant> > functions...> > If we have libpq_r then we're making a
completehash of it all - being> > reentrant is good, even if you're not using threads!> > Now, ecpg is another
issue...>I think the issue is that using a threaded library to link into libpq> could have locking stuff.> > My guess
isthat if the OS has separate threaded libs, we have to mimic> that stuff.
 

But there are NO thread primitives/calls in libpq - it's just a normal
shared library, it has has no thread voodoo! A threaded app/library
using libpq doesn't have to do anything special... libpq doesn't need
link the threads library (and it explicitly should not) - only define
_REENTRANT.

The reentrant calls libpq may be using are in the standard system
libraries (not the system thread library), the same libraries that the
app/libs will be linked against.

Now, libecpg on the otherhand does need mutex locks compiled in. Thus
if this is enabled then anyone who links against it also needs to link
in threads (unless the system is "intelligent" like Solaris and
includes empty stubs of the thread functions in libc).

However in this day and age the overhead of the locks are negligible
and it is more desirable to have one library...

L.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: this is in plain text (row level locks)
Следующее
От: Larry Rosenman
Дата:
Сообщение: Re: libpq_r