From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 23 Aug 2012 11:48:05 -0400 To: 9fans@9fans.net Message-ID: <8f993036a08798eb44ab78b5c8241885@brasstown.quanstro.net> In-Reply-To: <2A9FAAF6-97E1-45A6-BF54-609130B99FA3@bitblocks.com> References: <2A9FAAF6-97E1-45A6-BF54-609130B99FA3@bitblocks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] devmnt crash, fix. Topicbox-Message-UUID: aed94f8e-ead7-11e9-9d60-3106f5b1d025 > > Indeed. One way to catch sleep() errors is to change wakeup() to wake *everyone* up. i was thinking on this and it occurred to me .... to make the point by absurdity, consider this approximation of sleep and wakeup without notes. void sleep(Rendez*, void (*)(void*), void*) { } void wakeup(Rendez*) { } these have the property that you may wake without the condition but you may not miss a wakeup. it also doesn't matter if the condition happens while sleep is executing. and there is no hazard between the two. so i think this impemenation does satisfy the all the requirements! i didn't say it was efficient. :-) i think what cinap is thinking is, how could devmnt's particular use of sleep/wakeup with this particular implementation of sleep/wakeup evade handling spurious wakeups. if that's what the thought is, i would resist it. it may be that someone thinks of a very efficient way of re-implementing sleep/wakeup that may have slightly different properties. as long as the client and sleep/wakeup play by the rules, this should not be a problem. (it's possible to do plan 9-style sleep wakeup within, say, the windows kernel.) - erik