At 11:27 AM 5/4/2001 -0400, Benjamin Sugars wrote:
>On Fri, 4 May 2001, Chris Stith wrote:
>
> > My suggestion is to let libraries that are threadsafe (system
> > libraries as well as Perl moduels would be nice) be used as such
> > so the advantages of that can be realized, while at the same time
> > defaulting to serialized calls for libraries which are not, so
> > your threaded programs which need to call nonreentrant functions
> > can do so with some level of safety.
>
>I still don't buy it. Consider a non-thread-safe getpwnam(), and
>serialized access from two threads:
That problem is the same as if you called getpwnam() from multiple places
in your program without making sure that you're properly set up or cleaned
up. Serializing won't fix that. It will fix the cases where there's no
persistent state (or persistent state that's essentially invisible, such as
malloc's freelist) but the functions being called aren't reentrant.
It is *not* a universal panacea, but it is a perfectly fine one for a
subset of the non-threadsafe calls.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk