well, I have never tried to verify it with the spec, but I know for
sure that printf() and friends does not work well together with
pthreads... At least this is my practical experience (all too often).

Rainer

On Thu, Jan 29, 2009 at 11:02 AM, Julian Seward <jsew...@acm.org> wrote:
>
> On Thursday 29 January 2009, Rainer Gerhards wrote:
>
>> The standard io library is not thread safe.
>
> Are you sure about that?
>
> http://www.unix.org/whitepapers/reentrant.html:
>
>  The POSIX.1 and C-language functions that operate on character
>  streams (represented by pointers to objects of type FILE) are
>  required by POSIX.1c to be implemented in such a way that reentrancy
>  is achieved (see ISO/IEC 9945:1-1996, ยง8.2). This requirement has a
>  drawback; it imposes substantial performance penalties because of the
>  synchronization that must be built into the implementations of the
>  functions for the sake of reentrancy.
>
> AIUI fprintf et al are thread safe.  glibc implements its own locking
> inside the FILE*'s passed to such functions.  Neither Drd nor Helgrind
> can "see" this locking and that gives them big problems; both tools
> simply attempt to hide (suppress) such races, not always successfully.
>
> J
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to