In message <[EMAIL PROTECTED]>, 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
[EMAIL PROTECTED]         | 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to