From owner-freebsd-current Fri Aug 11 11:23:25 2000 Delivered-To: freebsd-current@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id 4408237B5A6 for ; Fri, 11 Aug 2000 11:23:10 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.3/8.9.3) with ESMTP id UAA23504; Fri, 11 Aug 2000 20:22:46 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Stephen McKay Cc: freebsd-current@FreeBSD.ORG, David Greenman , Alfred Perlstein Subject: Re: Ugly, slow shutdown In-Reply-To: Your message of "Sat, 12 Aug 2000 03:02:40 +1000." <20000812030240.A668@gift.home> Date: Fri, 11 Aug 2000 20:22:46 +0200 Message-ID: <23502.966018166@critter> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <20000812030240.A668@gift.home>, Stephen McKay writes: >Regardless of the history of it all, FreeBSD is full of places where >unexpected wakeups can stuff you right up. Should we regard tsleep() like >the older sleep() call, as suspect, and program defensively? Should we >be pragmatic, admit "We've gotten away with it so far", and document the >"no sudden wakeups" behaviour? > >I quite like the general principle outlined in one of the earlier replies, >that a while loop can be shown to be correct through a local code reading, >but a simple conditional must be verified by reading all the rest of the >code. That's close to the same argument I use against global variables. >Their use is too hard to verify as correct. I support this notion with a footnote to the effect that if the test is expensive the while() can be left out if a comment points out exactly why the while() isn't needed. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message