<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Interesting read. Thanks for the info, guys. Anyhow, I fixed this
issue since it seemed like a no-brainer to fix just to be safe, and
the fix made the code more efficient at least in theory anyhow.
However, based on eating my own dogfood for a long time and never
running into this, I don't think it happens on x86.<br>
<br>
On 8/31/2010 7:24 PM, Brad Roberts wrote:
<blockquote
cite="mid:alpine.DEB.2.00.1008311621170.23754@slice-2.puremagic.com"
type="cite">
<pre wrap="">On Tue, 31 Aug 2010, Sean Kelly wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Aug 31, 2010, at 12:41 PM, David Simcha wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
When waiting on condition variables, there's a remote chance that wait() will return when there isn't actually something to process. Instead of:
if (!condition)
wait();
use:
while (!condition)
wait();
I saw the "if" approach in "AbstractTask* pop()"... I think that's the only one.
Thanks, will do. How does this happen, though?
</pre>
</blockquote>
<pre wrap="">
Theoretical mumbo-jumbo, mostly. Here's the wiki entry: <a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Spurious_wakeup">http://en.wikipedia.org/wiki/Spurious_wakeup</a> For the most part, it's just good programming practice to double-check the invariant on wakeup.
</pre>
</blockquote>
<pre wrap="">
Very much not theoretical. I've seen it happen more than a little. A lot
of it can be blamed on using notify all rather than notify one type
behavior. The other ways it can happen is signals for things like gc
pause/resume, or pipe, or ... breaking in-progress sleeps.
It's one of the class of issues that tends not to happen in small simple
apps, so don't learn the risks until later in some large or complex app,
wierd things happen.
Anyway, gotta do it, it does happen.
Later,
Brad</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
phobos mailing list
<a class="moz-txt-link-abbreviated" href="mailto:phobos@puremagic.com">phobos@puremagic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/phobos">http://lists.puremagic.com/mailman/listinfo/phobos</a></pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
phobos mailing list
<a class="moz-txt-link-abbreviated" href="mailto:phobos@puremagic.com">phobos@puremagic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/phobos">http://lists.puremagic.com/mailman/listinfo/phobos</a></pre>
</blockquote>
<br>
</body>
</html>