X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Fboost%2Finterprocess%2Fsync%2Fspin%2Fmutex.hpp;h=c2a6f42ada0017400f506f64128a00097c83936c;hb=92f5a8d42d07f9929ae4fa7e01342fe8d96808a8;hp=7663673433aef624580a430822b2335050e946ca;hpb=a0324939f9d0e1905d5df8f57442f09dc70af83d;p=ceph.git diff --git a/ceph/src/boost/boost/interprocess/sync/spin/mutex.hpp b/ceph/src/boost/boost/interprocess/sync/spin/mutex.hpp index 766367343..c2a6f42ad 100644 --- a/ceph/src/boost/boost/interprocess/sync/spin/mutex.hpp +++ b/ceph/src/boost/boost/interprocess/sync/spin/mutex.hpp @@ -45,7 +45,7 @@ class spin_mutex bool try_lock(); bool timed_lock(const boost::posix_time::ptime &abs_time); void unlock(); - void take_ownership(){}; + void take_ownership(){} private: volatile boost::uint32_t m_s; }; @@ -64,7 +64,21 @@ inline spin_mutex::~spin_mutex() } inline void spin_mutex::lock(void) -{ return ipcdetail::try_based_lock(*this); } +{ +#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING + boost::posix_time::ptime wait_time + = microsec_clock::universal_time() + + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS); + if (!timed_lock(wait_time)) + { + throw interprocess_exception(timeout_when_locking_error + , "Interprocess mutex timeout when locking. Possible deadlock: " + "owner died without unlocking?"); + } +#else + return ipcdetail::try_based_lock(*this); +#endif +} inline bool spin_mutex::try_lock(void) {