Re: FreeBSD/i386 thread test - Mailing list pgsql-hackers

From Manfred Spraul
Subject Re: FreeBSD/i386 thread test
Date
Msg-id 3F5D0011.3050506@colorfullife.com
Whole thread Raw
In response to Re: FreeBSD/i386 thread test  (Jeroen Ruigrok/asmodai <asmodai@wxs.nl>)
Responses Re: FreeBSD/i386 thread test
List 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




pgsql-hackers by date:

Previous
From: Jeroen Ruigrok/asmodai
Date:
Subject: Re: FreeBSD/i386 thread test
Next
From: Tom Lane
Date:
Subject: Re: [PATCHES] mcxt.c