httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Hyde <>
Subject RE: more multithread unsafe stuff
Date Fri, 19 Dec 1997 16:51:53 GMT

On Friday, December 19, 1997 11:38 AM, Paul Sutton []
>  ... You can get into trouble if you compile parts
> with different runtimes, but the linker will bitch 
Of course then there is dynamicly loading stuff at runtime provided by
third parties.

> > One of the libraries is "thread safe,"  I haven't' checked to see
> > Apache is configured to use today.  Even there the time functions
> > above aren't safe. 
> >
> > So, this is a problem today on windows.
> Can you provide some more information? I was under the impression that
> both the MT libraries provided 100% thread-safe C runtime calls. If
> surely there would be problems throughout windows which uses MT all
> the place?
I suspect they didn't try to be more thread safe in the "thread safe"
library than
the standard required.  

Compare the doc for strtok and gmtime.  In strtok they write:
  "Warning Each of these functions uses a static variable for parsing
the string into tokens. 
    If multiple or simultaneous calls are made to the same function, a
high potential for data 
    corruption and inaccurate results exists. Therefore, do not attempt
to call the same 
    function simultaneously for different strings and be aware of
calling one of these 
    function from within a loop where another routine may be called that
uses the same 
    function. However, calling this function simultaneously from
multiple threads does not 
    have undesirable effects."

For gmtime they only say that it uses a shared static variable.  The
absence of the
"not have undesirable effects" suggests to be that it does have the
"undesirable effects."

I presume that the thread safe runtime library is exists because the
original library
wasn't - and at the time they didn't have threads.  That when they added
they had to write an entirely new library for assorted reasons.  The
library they
wrote is almost only as thread safe as the standards required, since
doing better than the
standards tends to get one into trouble with feature creep and tedious

 - ben

ps (anybody know why Outlook word wraps my messages and how to get it
to stop?)

View raw message