[openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting

  • From: "Alexander G. M. Smith" <agmsmith@xxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 10 Dec 2002 19:01:26 EST (-0500)

Axel Dörfler wrote on Tue, 10 Dec 2002 23:30:50 +0100 CET:
> I don't understand how a reentrant function can't be thread-safe, but 
> other than that, I think this explanation looks good :-)

An example: The function increments a global integer which
says that it has been called N times, in a single threaded
world it would just tell you how deeply nested the recursive
calls are.  But if a separate thread then jumps in and calls
it, the nesting count will be wrong and it will do unexpected
things (perhaps it does some initialization when the count
is zero for the top level call).

- Alex



Other related posts: