Re: FreeBSD/i386 thread test
Manfred Spraul <manfred@colorfullife.com>
From: Manfred Spraul <manfred@colorfullife.com>
To: Jeroen Ruigrok/asmodai <asmodai@wxs.nl>
Cc: Peter Eisentraut <peter_e@gmx.net>,
Bruce Momjian <pgman@candle.pha.pa.us>, Christopher Kings-Lynne <chriskl@familyhealth.com.au>, pgsql-hackers@postgresql.org
Date: 2003-09-08T22:17:53Z
Lists: pgsql-hackers
Jeroen Ruigrok/asmodai wrote:
>-On [20030908 23:52], Peter Eisentraut (peter_e@gmx.net) wrote:
>
>
>>Why would FreeBSD have a "library of thread-safe libc functions" (libc_r)
>>if the functions weren't thread-safe? I think the test is faulty.
>>
>>
A thread-safe library has a per-thread errno value (i.e. errno is a
#define to a function call), thread-safe io buffers for stdio, etc. Some
of these changes cause a noticable overhead, thus a seperate library for
those users who want to avoid that overhead.
Reentrancy is independant from _r: If you look at the prototype of
gethostbyname(), it's just not possible to make that thread safe with
reasonable effort - the C library would have to keep one buffer per
thread around.
>Having libc_r is not a guarantee that all functions of libc are
>represented in that library as thread-safe functions.
>
>gethostbyname_r() is a notable reentrant function which is absent in
>FreeBSD.
>
>
Is there a thread-safe alternate to gethostbyname() for FreeBSD?
--
Manfred