From owner-cvs-src@FreeBSD.ORG Thu Mar 8 00:59:11 2007 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A99116A402; Thu, 8 Mar 2007 00:59:11 +0000 (UTC) (envelope-from grog@lemis.com) Received: from ext-gw.lemis.com (ext-gw.lemis.com [150.101.14.10]) by mx1.freebsd.org (Postfix) with ESMTP id 8027F13C461; Thu, 8 Mar 2007 00:59:10 +0000 (UTC) (envelope-from grog@lemis.com) Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.135]) by ext-gw.lemis.com (Postfix) with ESMTP id 4E091133CDC; Thu, 8 Mar 2007 11:29:09 +1030 (CST) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 3D6BA1AA1DE; Thu, 8 Mar 2007 11:29:09 +1030 (CST) Date: Thu, 8 Mar 2007 11:29:09 +1030 From: Greg 'groggy' Lehey To: John Baldwin Message-ID: <20070308005909.GN68567@wantadilla.lemis.com> References: <200703042342.l24Ngwmu040217@repoman.freebsd.org> <20070305092518.F44433@fledge.watson.org> <200703051032.20618.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lLR1BQqf7txDtYcF" Content-Disposition: inline In-Reply-To: <200703051032.20618.jhb@freebsd.org> User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 VoIP: sip:0871270137@sip.internode.on.net WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, Robert Watson , cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man9 sleep.9 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2007 00:59:11 -0000 --lLR1BQqf7txDtYcF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline [Format recovered--see http://www.lemis.com/email/email-format.html] Wrapping corrected. On Monday, 5 March 2007 at 10:32:19 -0500, John Baldwin wrote: > On Monday 05 March 2007 04:36, Robert Watson wrote: >> >> On Sun, 4 Mar 2007, Greg Lehey wrote: >> >>> grog 2007-03-04 23:42:58 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> share/man/man9 sleep.9 >>> Log: >>> Rearrange function descriptions in more logical order. >>> Be less alarmist about the dangers of abusing wakeup_one(). >> >> How would you feel about language along the lines of: >> >> Prior to the introduction of wakeup_one(), using a single wait >> channel address was possible as long as all sleepers looped >> around the sleep call re-checking the condition after each >> wakeup. However, with the addition of wakeup_one(), combining >> wait channels for multiple purposes may lead easily to bugs >> involving lost wakeups, and is strongly discouraged. It is >> recommended that consumers of the sleep(9) programming interface >> carefully follow the convention of using only wait channels >> associated with memory addresses explicitly allocated for this >> purpose, and not overload or extend the semantics of existing >> wait channels without careful analysis in order to avoid >> potential channel collisions. Programmers may find the cv(9) >> interface easier to use correctly, as it has explicit condition >> variable data structures. >> >> That way we combine warnings about potential misuse with a >> recommendation for the cv(9) API. > > How about a far simpler sentence: > > Programmers should ensure that wait channels are not used for > multiple events. Agreed that rwatson's is too long, but what's your objection to the way it is now? > Unless there is wide misunderstanding of this concept (which there > doesn't seem to be judging from the followups) we shouldn't spend > any more length on the topic than that. When porting drivers from other places, we can't assume that the driver writer was as aware of the issue as those relatively few who have participated in this discussion. I'm currently looking at a driver which has misunderstood a number of issues in this area. It also appears to work unless the kernel is compiled with INVARIANTS. The duplicate event per wchan issue is even more subtle: it can work for ever and then hang inexplicably. Greg -- When replying to this message, please take care not to mutilate the original text. For more information, see http://www.lemis.com/email.html See complete headers for address and phone numbers. --lLR1BQqf7txDtYcF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFF71/dIubykFB6QiMRAj7ZAJwJj5/DFqfhnP75ZSOQEbTP135qdQCggKdt iejAvLo2suzyEOQp/oLA+/Y= =pHtP -----END PGP SIGNATURE----- --lLR1BQqf7txDtYcF--