Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Feb 2011 21:12:30 -0500
From:      Daniel Eischen <eischen@vigrid.com>
To:        Yuri <yuri@rawbw.com>
Cc:        Garrett Cooper <yanegomi@gmail.com>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, "standards@freebsd.org" <standards@freebsd.org>, "davidxu@freebsd.org" <davidxu@freebsd.org>
Subject:   Re: Is pthread_cond_signal(3) man page correct?
Message-ID:  <DCEE47BA-43FC-4C6F-AC9D-4689DD067B20@vigrid.com>
In-Reply-To: <4D6AC17A.7020505@rawbw.com>
References:  <4D6ABA14.80208@rawbw.com> <4D6AC17A.7020505@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Feb 27, 2011, at 4:26 PM, Yuri <yuri@rawbw.com> wrote:

> Forwarding to standards@ and davidxu@ per Garrett Cooper suggestion.
>=20
> Also I want to add that I came to this question while observing behavior c=
onsistent with multiple wakeup on FreeBSD-8.1. The heavily multi-threaded co=
de that assumes that only one thread can be woken up by one pthread_cond_sig=
nal call crashes, and the only reasonable explanation so far is that more th=
an one threads are actually being woken up.

It depends on what you mean by wakeup.  More than one thread may unblock, bu=
t only one thread will have the mutex locked after wakeup.  If other threads=
 awake (as allowed by POSIX), they will have to check the state protected by=
 the mutex to see if they really should awake and continue  or if they shoul=
d block again on the CV.  A wakeup from pthread_cond_wait() should not assum=
e that he was the only thread awoken.

--
DE=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DCEE47BA-43FC-4C6F-AC9D-4689DD067B20>