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

Yes, more or less.

Reentrant code is code which can be 're-entered' by the execution path
safely. Be it in different threads, or the same thread.

I probably should not have used that word as it has confused the issue.

The real issue is thread safety.

=)

Alan

On Tue, Dec 10, 2002 at 02:51:58PM -0500, Scott MacMaster wrote:
> > I think there may be a confusion here between "reentrant" and
> > "thread-safe".  IIRC, reentrant functions produce the same result each
> > time they are called with identical arguments (e.g. sqrt(8)).  strtok
> > is an example of a non-reentrant function (look at it's definition to
> > see why).  Thread-safe functions are functions which can be called
> > from several threads simultaneously.  IMHO, all the BeOS library
> > functions should be thread-safe, although many may not be re-entrant.
> 
> I researched what reentrant meant after it was mentioned yesterday.  I read
> that reentrant functions are functions that neither use static data nor
> return pointer to static data.  In addition, a reentrant functions does not
> have to be thread-safe but a non-reentrant function is not thread-safe.  The
> definition I read didn't say that a reentrant function has to return the
> same thing each time it's called with the same parameters.
> 
> Is what I read correct?
> http://www.unet.univie.ac.at/aix/aixprggd/genprogc/writing_reentrant_thread_
> safe_code.htm
> 
> 
> 
> Scott MacMaster
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.427 / Virus Database: 240 - Release Date: 12/6/2002
> 

Other related posts: