[...]
First, note that this scheme is very prone to starvation problems. If an operation "type" acquires the "lock" and there are several threads that will also acquire this same "type" in a loop, it may very well be that the "lock" is never relinquished for the other "types" to acquire it. RW locks are a little tricky to implement because of this issue.
Can you elaborate a bit more on that one, help me to understand. Is there any way out of this problem? How can I prevent it? [...]
You didn't use boost::condition incorrectly, you used the scoped_lock<> incorrectly. Fixing this, though, still leaves you with a questionable synchronization scheme that's prone to
starvation.
Odly enough I alway use scoped_lock they way it is intended to be used. I got a confused when reading through the documentation of boost::condition and how condition::wait affects the lock. Thanks to your comments I got it working and it behaves as I expect it would. I would surely appreciate if you (or someone else) could futher clarify the starvation problem. Sven