Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-08-21 09:16:07

Looks like we'll need to do some more research to figure out:

1. Can CV's be implemented portably without the lock during notify()
  restriction? (yes for pthreads, maybe for Win32?)
2. Are there any performance trade-offs?
   (no lock is better with pthreads, Win32?)
3. Should the boost CV interface require lock during notify()?

William Kempf writes:
> I'm not an expert on pthreads. Everything that I do know comes from
> Pthreads Programming, O'Reilly & Associates, Inc. (a Nutshell book).
> To quote them, from page 82:
> "It all sounds complicated, but what if the mutex and the condition
> variable weren't linked? If the condition were signaled without a
> mutex, the signaling thread might signal the condition before the
> waiting thread begins waiting for it -- in which case the waiting
> thread would never wake up."
> > Perhaps the problem came from how you were implementing CVs
> > on Win32?
> The implementation I have is based on the implementation designed by
> Douglas Schmidt (sp?) for the ACE framework. He's one of the leading
> authorities on this subject. There is a definate race condition in
> this implementation if the external mutex isn't locked during the
> call to notify().
> Sounds like this is a non-issue for pthreads, at least according to
> the quote you gave from the standard. I must admit to be confused on
> this subject now, though. :(

Boost list run by bdawes at, gregod at, cpdaniel at, john at