From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 25 Feb 2011 00:26:44 -0500 To: 9fans@9fans.net Message-ID: <11da45046fa8267e7445128ed00724cd@ladd.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] sleep/wakeup bug? Topicbox-Message-UUID: b4560b92-ead6-11e9-9d60-3106f5b1d025 > assuming a tight 1:1 coupling between sleep and > wakeup is a recipe for trouble. even if your change > fixes one possible race (i didn't bother to see what changed), > you still have to deal with the point of sleep/rendezvous is tight coupling, no? the change was to move the ready() to after the rendezvous lock was dropped. therefore the sleeper knows the rendezvous is not locked by the event that woke him. if one can assert that each sleep has exactly one wakeup (as is often the case for rpc-style programming), then that is enough to know the rendezvous can be retired. > these races are inherent to the definition of sleep and > wakeup. it doesn't mean what you need it to mean > to free memory immediately after sleeping on it. if not a tight coupling, what kind of coupling would you think is appropriate? when would you think it would be fair to recycle the rendezvous? 10s? :-) what idiom do you think would be appropriate for such a case? - erik