
On Mon, Sep 1, 2008 at 7:44 PM, Stjepan Rajko <stipe@asu.edu> wrote:
On Mon, Sep 1, 2008 at 9:35 AM, Giovanni Piero Deretta <gpderetta@gmail.com> wrote:
On Mon, Sep 1, 2008 at 7:19 AM, Jaakko Järvi <jarvi@cs.tamu.edu> wrote:
The review of Stjepan Rajko's Dataflow library starts today, September 1st, and will run until September 10th.
Hi, while skimming through the Dataflow documentation, I noticed an error in the distributed example (http://tinyurl.com/5qcjxx):
Thanks for raising this issue - threading is definitely not my forte, and it's quite possible that I'm doing something weird. I see, looking at the docs:
template <typename ScopedLock> void wait(ScopedLock& lock);
Danger: This version should always be used within a loop checking that the state logically associated with the condition has become true. Without the loop, race conditions can ensue due to possible "spurious wake ups".
I wasn't aware of the "spurious wake ups" issue. I will fix the code as you recommended.
Spurious wakeups are rare in practice. OTOH, what is more likely to happen is that the main thread could miss the wake-up if the worker thread managed to signal the condition variable before the main thread got to wait for it (remember that condition variables are stateless). HTH, -- gpd