Boost logo

Boost Users :

Subject: [Boost-users] [repost][threads] recursive shared_mutex
From: JOAQUIN M. LOPEZ MUÑOZ (joaquin_at_[hidden])
Date: 2009-04-20 16:28:56


Hi, allow me to repost this query of mine that went
without much attention at first try...

As the docs do not explicitly say otherwise, I guess I must assume that
boost::shared_mutex is not recursive with respect to unique ownership,
that is, the following behavior ensues:

  shared_mutex mutex;
  lock_guard<shared_mutex> lock1(mutex);
  lock_guard<shared_mutex> lock2(mutex); // DEADLOCK

Is this so? In case boost::shared_mutex is indeed non-recursive, I've
read the following assertion on Hinnant's paper N2406
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2406.html ):

  "A recursive shared mutex could be built upon shared_mutex if desired,
  but this is not proposed."

Does anyone has a reference on how to construct a recursive
shared_mutex from a non-recursive one?

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo



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