Gordon Smith wrote:
The following code seems to deadlock on the second (read) scoped lock (not what I would expect):
boost::read_write_mutex mutex(boost::read_write_scheduling_policy::alternating_single_read); {
boost::read_write_mutex::scoped_write_lock writeLock(mutex);
}
{
boost::read_write_mutex::scoped_read_lock readLock(mutex);
}
There are some definite problems with read_write_mutex in the 1.31 release and this is one of them. Unfortunately the unit tests were quite lacking and didn't catch a bug as simple as this. I have a fixed read_write_mutex that I'm nearly ready to check in. I'm not happy with it--the code is too complex and the mutex object is too big, but at least it's a lot more correct, I hope. I have also expanded the unit tests. Probably too much, in fact: they check a lot more, but there is some duplication and they take quite a long time to run. Mike