httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David D'Antonio" <>
Subject RE: more multithread unsafe stuff
Date Fri, 19 Dec 1997 17:02:01 GMT
On Friday, December 19, 1997 11:52 AM, Ben Hyde [] 
> On Friday, December 19, 1997 11:38 AM, Paul Sutton []
> wrote:
> >  ... 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
> unknown
> third parties.



> > Can you provide some more information? I was under the impression that
> > both the MT libraries provided 100% thread-safe C runtime calls. If
> not
> > surely there would be problems throughout windows which uses MT all
> over
> > the place?

Well, a lot of people would claim there ARE problems throughout Windows. 

> 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."

They are probably getting "thread local storage" for that static variable. 
each thread can all the thing simultaneously and have no trouble. But 
it within the same thread all over the place can screw things up.

> 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
> threads
> 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
> porting
> surprises.

Well, the MS way isn't to "over implement" things so you are most likely
correct. Win16 certainly wasn't thread-safe (no threads, no problem :-), 
they did have to write it for Win32. The reason the single-threaded 
library is
available is that it (presumably) has a lower overhead and if you know 
app using a single thread, why not?

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

If you mean wrapping on send, then check under Tools->Options->Internet 
tab. You should see a checkbox for wrapping and a length to which to wrap 


David D'Antonio CNE -
 Some they do and some they don't and some ya just can't tell
  Some they will and some they won't and some it's just as well

View raw message