From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 28 02:26:35 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D95B3106566B; Mon, 28 Feb 2011 02:26:35 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 92D4E8FC1A; Mon, 28 Feb 2011 02:26:35 +0000 (UTC) Received: from [10.0.0.19] (ip-414b102e.ct.fixed.ntplx.com [65.75.16.46]) (authenticated bits=0) by mail.netplex.net (8.14.4/8.14.4/NETPLEX) with ESMTP id p1S2CWLf013661 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sun, 27 Feb 2011 21:12:33 -0500 X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (mail.netplex.net [204.213.176.10]); Sun, 27 Feb 2011 21:12:33 -0500 (EST) References: <4D6ABA14.80208@rawbw.com> <4D6AC17A.7020505@rawbw.com> In-Reply-To: <4D6AC17A.7020505@rawbw.com> Mime-Version: 1.0 (iPhone Mail 8C148) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (8C148) From: Daniel Eischen Date: Sun, 27 Feb 2011 21:12:30 -0500 To: Yuri Cc: Garrett Cooper , "freebsd-hackers@freebsd.org" , "standards@freebsd.org" , "davidxu@freebsd.org" Subject: Re: Is pthread_cond_signal(3) man page correct? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2011 02:26:35 -0000 On Feb 27, 2011, at 4:26 PM, Yuri 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=