Boost logo

Boost Users :

Subject: [Boost-users] Interprocess condition and process crashes
From: Gabriel Burca (gburca-boost_at_[hidden])
Date: 2009-09-17 13:45:19


I'm using Boost 1.39 on WindowsXP and I noticed that if a process crashes
while waiting on an interprocess condition variable, the signaling process
blocks forever in subsequent calls to notify_all().

It looks to me like boost is not using the native facilities, but some
emulation, so is this scenario not supported by the emulation?

The code is very simple:

Process A:
while (1) {
  {
    scoped_lock<named_mutex> lock(mut);
    cond.wait(lock); // Process A might be killed or die while in this
call
    // do some work
  }
}

Process B:
void notifyOthers() {
  scoped_lock<named_mutex> lock(mut);
  cond.notify_all();
}

I've actually omitted one small detail in the description above. After
process A dies, process B can execute notifyOthers() again only once. The
second time it never makes it out of the notify_all().

-- 
Gabriel Burca

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net