Boost logo

Boost :

From: dherring_at_[hidden]
Date: 2007-05-23 13:15:18


I think there's a minor mistake in the template code for

***** Begin example *****
using namespace boost::interprocess;

   typedef interprocess_recursive_mutex MutexT;
   typedef interprocess_mutex MutexT;

MutexT mutex;
scoped_lock<MutexT> lock(mutex);
interprocess_condition condition;
condition.wait(lock); // compilation error when USE_RECURSIVE is defined
***** End example *****

Here, wait() is templated on the lock type; but this calls do_wait(),
which requires interprocess_mutex. Is there a reason why do_wait() cannot
accept a recursive mutex?

The attached diff contains one possible solution:
- Template do_wait() on the mutex type.
- Add "friend class interprocess_condition" to the recursive mutex (as it
   is in the nonrecursive mutex).

This seems to work on my computer (with POSIX_SHARED_MEMORY_OBJECTS); it
has't been tested with the POSIX emulation.


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