Date: Tue, 20 Mar 2012 08:07:48 +0800 From: David Xu <listlog2011@gmail.com> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, davidxu@freebsd.org Subject: Re: svn commit: r233103 - head/lib/libthr/thread Message-ID: <4F67CA54.4050405@gmail.com> In-Reply-To: <201203191350.51888.jhb@freebsd.org> References: <201203180022.q2I0MThr093557@svn.freebsd.org> <201203190833.08153.jhb@freebsd.org> <4F6753C1.4060800@gmail.com> <201203191350.51888.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2012/3/20 1:50, John Baldwin wrote: > http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_cond_destroy.html > This is quite different as assuming a broadcast marks all the threads as runnable > and removes them from the cv's queue, none of the threads will have references to > the cv so it will be safe to destroy. It would not be safe to destroy the mutex > in that case though (and the example does not destroy the mutex, only the cv). > Also an implementation based on sequence number to detect broadcast will suffer from the problem because it needs to recheck the sequence number after unblocking to make sure it is not a spurious wakeup or a signal sent to the thread which makes it return to user mode.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F67CA54.4050405>