This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Thread safe functions from the C standard library
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: "David Livshin" <david dot livshin at dalsoft dot com>
- Cc: libc-help at sourceware dot org
- Date: Tue, 9 Dec 2008 11:43:15 -0500
- Subject: Re: Thread safe functions from the C standard library
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=tofolwTZ/Uy228earvVNccokRtc8X5NPNLNqYtSTma4=; b=bb2pQeqjmaq/Oeijt61tzFdD+oM35MpLBHsG3h7vozEjLjySn9dW6Syvk9XgzJ5/kc aMHgXEbYVEKjBg3dpQxcuE0ckBWykdbix9bFjqYo462yaaCB2sOEi7H1y9A76bQOOVG6 wla6BOIvUASzXsqpZaGR1EDDzJKuG7raWp6o0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=d1IMM9UJ5Sd7bI3HZ0aNL0KYyaJh2a0nAMVBmr9UxYNED0Tz2ryDtDj0ybBso1Ftwb rUrjeSGl9LDkDTugsN6QXLgCTgDoBb1AunAlzWuoQrDgq0nYANCdHOSexLjhQLpjIVEQ 87E57qzMRno12POhTcfxcP/8rwb0COmvO1OSo=
- References: <493E93C7.80907@dalsoft.com>
On Tue, Dec 9, 2008 at 10:50 AM, David Livshin
<david.livshin@dalsoft.com> wrote:
> Hi,
>
> What functions from the GNU's C standard libraries ( libc, libm ) are thread
> safe? Of a particular interest are transcendental functions ( like 'exp',
> 'sin' etc. ) - are they thread safe?
>
> Are there any requirements/guidelines/assurances regarding thread safety of
> functions from a C library?
GLIBC strives to be ISO C and POSIX compliant. POSIX gives assurances
with regards to thread-safety and reentrancy (two distinct issues).
For example ISO C and POSIX define "exp" e.g.
http://www.opengroup.org/onlinepubs/009695399/functions/exp.html
The POSIX thread-safey section:
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html#tag_02_09_01
does not list exp in the thread-unsafe functions, therefore it should
be thread-safe.
Cheers,
Carlos.