[openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- From: Isaac Yonemoto <ityonemo@xxxxxxxxxxxx>
- To: "Frank D. Engel, Jr." <fde101@xxxxxxxxx>
- Date: Thu, 12 Dec 2002 09:37:24 -0600 (CST)
> I believe that a "reentrant" function is one which can be safely called
> before a previous call to that same function completes. This would
> imply lack of self-modifying code, etc., and is more related to
> recursion than thread safety.
No. Being reentrant has nothing to do with recursion.
Here is a non-reentrant form of a function:
float temp;
float add(a, b)
{
temp = a;
temp += b;
return temp
};
Because thread #1 might start running add, then get interrupted before
adding in "b" to a. Then thread #2 comes along, and runs add, changes the
value for temp. When thread #1 is resumed, the answer will be wrong.
Isaac
- References:
- [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- From: Frank D. Engel, Jr.
Other related posts:
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- » [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- [openbeos] Re: POSIX thread safety, was: Re: Waiting and waiting
- From: Frank D. Engel, Jr.