pthread unsafe macros

Alex Waugh alex at
Sun Jan 11 05:24:37 PST 2004

In message <3FFAB7B8.6070105 at>
          Nick Burrett <nick at> wrote:

> Alex,
> Could you explain why the function Bfree in strtod.c requires 
> PTHREAD_UNSAFE to be declared ?  I would have assumed that the 
> declaration is only needed at the toplevel function i.e. strtod rather 
> than at all child functions.
> Hmm.  On closer inspection of _ints.s, are you doing this so that 
> interrupts are disabled for as little time as possible ?

It's just a trade off between context switch latency and
efficiency/simplicity. In general if a function was thread safe but its
children weren't then I would only put PTHREAD_UNSAFE in the child
functions, which made things simpler when the child function was in a
different file or could be called from more than one parent function.
In strtod's case all the child functions are static thus it doesn't
really matter, and I suspect the difference would be unnoticable.


Alex Waugh                                           alex at

PHP, Roots, Subversion, WebJames and more from

More information about the gcc mailing list