Re: FreeBSD/i386 thread test

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: Jeroen Ruigrok/asmodai <asmodai(at)wxs(dot)nl>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: FreeBSD/i386 thread test
Date: 2003-09-08 22:17:53
Message-ID: 3F5D0011.3050506@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeroen Ruigrok/asmodai wrote:

>-On [20030908 23:52], Peter Eisentraut (peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-09-08 22:26:01 Re: [PATCHES] mcxt.c
Previous Message Tom Lane 2003-09-08 22:06:11 Re: ISO 8601 'Time Intervals' of the 'format with time-unit deignators'