[OpenAFS-devel] volserver hangs possible fix

Horst Birthelmer horst@riback.net
Tue, 19 Apr 2005 00:13:23 +0200


On Apr 18, 2005, at 6:33 PM, Jeffrey Hutzelman wrote:
>
> On Monday, April 18, 2005 05:01:06 PM +0200 Horst Birthelmer 
> <horst@riback.net> wrote:
>
>> Most implementations don't have an atomic cond_wait since it's not
>> mandatory by POSIX ;-)
>> It's just you have to treat it that way since there's no guaranty that
>> you can rely on an atomic implementation.

Ok, according to POSIX this paragraph was completely wrong.
I admit I didn't read the passage careful enough.
My apology for that ...

Here's that part again for hopefully clarifying things:
>
>        These functions [pthread_cont_timedwait, pthread_cond_wait]
>        atomically release _mutex_ and cause the calling thread to 
> block on
>        the condition variable _cond_; atomically here means "atomically
>        with respect to access by another thread to the mutex and then 
> the
>        condition variable".  That is, if another thread is able to 
> acquire
>        the mutex after the about-to-block thread has released it, then 
> a
>        subsequence call to pthread_cond_broadcast() or
>        pthread_cond_signal() in that thread shall behave as if it were
>        issued after the about-to-block thread has blocked.
>
>        -- IEEE Std. 1003.1-2001, p. 1032
>


Horst