From owner-svn-src-head@FreeBSD.ORG Tue Mar 20 00:07:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 620E0106564A; Tue, 20 Mar 2012 00:07:51 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 49D558FC15; Tue, 20 Mar 2012 00:07:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2K07nW1063291; Tue, 20 Mar 2012 00:07:50 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F67CA54.4050405@gmail.com> Date: Tue, 20 Mar 2012 08:07:48 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: John Baldwin References: <201203180022.q2I0MThr093557@svn.freebsd.org> <201203190833.08153.jhb@freebsd.org> <4F6753C1.4060800@gmail.com> <201203191350.51888.jhb@freebsd.org> In-Reply-To: <201203191350.51888.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 00:07:51 -0000 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.