named_upgradable_mutex.hpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/interprocess for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_INTERPROCESS_named_upgradable_mutex_HPP
  11. #define BOOST_INTERPROCESS_named_upgradable_mutex_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #
  16. #if defined(BOOST_HAS_PRAGMA_ONCE)
  17. # pragma once
  18. #endif
  19. #include <boost/interprocess/detail/config_begin.hpp>
  20. #include <boost/interprocess/detail/workaround.hpp>
  21. #include <boost/interprocess/creation_tags.hpp>
  22. #include <boost/interprocess/exceptions.hpp>
  23. #include <boost/interprocess/shared_memory_object.hpp>
  24. #include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
  25. #include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
  26. #include <boost/interprocess/sync/shm/named_creation_functor.hpp>
  27. #include <boost/interprocess/permissions.hpp>
  28. //!\file
  29. //!Describes a named upgradable mutex class for inter-process synchronization
  30. namespace boost {
  31. namespace interprocess {
  32. #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  33. namespace ipcdetail{ class interprocess_tester; }
  34. #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
  35. class named_condition;
  36. //!A upgradable mutex with a global name, so it can be found from different
  37. //!processes. This mutex can't be placed in shared memory, and
  38. //!each process should have it's own named upgradable mutex.
  39. class named_upgradable_mutex
  40. {
  41. #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  42. //Non-copyable
  43. named_upgradable_mutex();
  44. named_upgradable_mutex(const named_upgradable_mutex &);
  45. named_upgradable_mutex &operator=(const named_upgradable_mutex &);
  46. friend class named_condition;
  47. #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
  48. public:
  49. //!Creates a global upgradable mutex with a name.
  50. //!If the upgradable mutex can't be created throws interprocess_exception
  51. named_upgradable_mutex(create_only_t, const char *name, const permissions &perm = permissions());
  52. //!Opens or creates a global upgradable mutex with a name.
  53. //!If the upgradable mutex is created, this call is equivalent to
  54. //!named_upgradable_mutex(create_only_t, ...)
  55. //!If the upgradable mutex is already created, this call is equivalent to
  56. //!named_upgradable_mutex(open_only_t, ... ).
  57. named_upgradable_mutex(open_or_create_t, const char *name, const permissions &perm = permissions());
  58. //!Opens a global upgradable mutex with a name if that upgradable mutex
  59. //!is previously.
  60. //!created. If it is not previously created this function throws
  61. //!interprocess_exception.
  62. named_upgradable_mutex(open_only_t, const char *name);
  63. #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  64. //!Creates a global upgradable mutex with a name.
  65. //!If the upgradable mutex can't be created throws interprocess_exception
  66. //!
  67. //!Note: This function is only available on operating systems with
  68. //! native wchar_t APIs (e.g. Windows).
  69. named_upgradable_mutex(create_only_t, const wchar_t *name, const permissions &perm = permissions());
  70. //!Opens or creates a global upgradable mutex with a name.
  71. //!If the upgradable mutex is created, this call is equivalent to
  72. //!named_upgradable_mutex(create_only_t, ...)
  73. //!If the upgradable mutex is already created, this call is equivalent to
  74. //!named_upgradable_mutex(open_only_t, ... ).
  75. //!
  76. //!Note: This function is only available on operating systems with
  77. //! native wchar_t APIs (e.g. Windows).
  78. named_upgradable_mutex(open_or_create_t, const wchar_t *name, const permissions &perm = permissions());
  79. //!Opens a global upgradable mutex with a name if that upgradable mutex
  80. //!is previously.
  81. //!created. If it is not previously created this function throws
  82. //!interprocess_exception.
  83. //!
  84. //!Note: This function is only available on operating systems with
  85. //! native wchar_t APIs (e.g. Windows).
  86. named_upgradable_mutex(open_only_t, const wchar_t *name);
  87. #endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  88. //!Destroys *this and indicates that the calling process is finished using
  89. //!the resource. The destructor function will deallocate
  90. //!any system resources allocated by the system for use by this process for
  91. //!this resource. The resource can still be opened again calling
  92. //!the open constructor overload. To erase the resource from the system
  93. //!use remove().
  94. ~named_upgradable_mutex();
  95. //Exclusive locking
  96. //!Requires: The calling thread does not own the mutex.
  97. //!
  98. //!Effects: The calling thread tries to obtain exclusive ownership of the mutex,
  99. //! and if another thread has exclusive, sharable or upgradable ownership of
  100. //! the mutex, it waits until it can obtain the ownership.
  101. //!Throws: interprocess_exception on error.
  102. //!
  103. //!Note: A program may deadlock if the thread that has ownership calls
  104. //! this function. If the implementation can detect the deadlock,
  105. //! an exception could be thrown
  106. void lock();
  107. //!Requires: The calling thread does not own the mutex.
  108. //!
  109. //!Effects: The calling thread tries to acquire exclusive ownership of the mutex
  110. //! without waiting. If no other thread has exclusive, sharable or upgradable
  111. //! ownership of the mutex this succeeds.
  112. //!Returns: If it can acquire exclusive ownership immediately returns true.
  113. //! If it has to wait, returns false.
  114. //!Throws: interprocess_exception on error.
  115. //!
  116. //!Note: A program may deadlock if the thread that has ownership calls
  117. //! this function. If the implementation can detect the deadlock,
  118. //! an exception could be thrown
  119. bool try_lock();
  120. //!Requires: The calling thread does not own the mutex.
  121. //!
  122. //!Effects: The calling thread tries to acquire exclusive ownership of the mutex
  123. //! waiting if necessary until no other thread has exclusive, sharable or
  124. //! upgradable ownership of the mutex or abs_time is reached.
  125. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
  126. //!Throws: interprocess_exception on error.
  127. //!
  128. //!Note: A program may deadlock if the thread that has ownership calls
  129. //! this function. If the implementation can detect the deadlock,
  130. //! an exception could be thrown
  131. template<class TimePoint>
  132. bool timed_lock(const TimePoint &abs_time);
  133. //!Same as `timed_lock`, but this function is modeled after the
  134. //!standard library interface.
  135. template<class TimePoint> bool try_lock_until(const TimePoint &abs_time)
  136. { return this->timed_lock(abs_time); }
  137. //!Same as `timed_lock`, but this function is modeled after the
  138. //!standard library interface.
  139. template<class Duration> bool try_lock_for(const Duration &dur)
  140. { return this->timed_lock(ipcdetail::duration_to_ustime(dur)); }
  141. //!Precondition: The thread must have exclusive ownership of the mutex.
  142. //!Effects: The calling thread releases the exclusive ownership of the mutex.
  143. //!Throws: An exception derived from interprocess_exception on error.
  144. void unlock();
  145. //Sharable locking
  146. //!Requires: The calling thread does not own the mutex.
  147. //!
  148. //!Effects: The calling thread tries to obtain sharable ownership of the mutex,
  149. //! and if another thread has exclusive ownership of the mutex,
  150. //! waits until it can obtain the ownership.
  151. //!Throws: interprocess_exception on error.
  152. //!
  153. //!Note: A program may deadlock if the thread that has ownership calls
  154. //! this function. If the implementation can detect the deadlock,
  155. //! an exception could be thrown
  156. void lock_sharable();
  157. //!Same as `lock_sharable` but with a std-compatible interface
  158. //!
  159. void lock_shared()
  160. { this->lock_sharable(); }
  161. //!Requires: The calling thread does not own the mutex.
  162. //!
  163. //!Effects: The calling thread tries to acquire sharable ownership of the mutex
  164. //! without waiting. If no other thread has exclusive ownership
  165. //! of the mutex this succeeds.
  166. //!Returns: If it can acquire sharable ownership immediately returns true. If it
  167. //! has to wait, returns false.
  168. //!Throws: interprocess_exception on error.
  169. //!
  170. //!Note: A program may deadlock if the thread that has ownership calls
  171. //! this function. If the implementation can detect the deadlock,
  172. //! an exception could be thrown
  173. bool try_lock_sharable();
  174. //!Same as `try_lock_sharable` but with a std-compatible interface
  175. //!
  176. bool try_lock_shared()
  177. { return this->try_lock_sharable(); }
  178. //!Requires: The calling thread does not own the mutex.
  179. //!
  180. //!Effects: The calling thread tries to acquire sharable ownership of the mutex
  181. //! waiting if necessary until no other thread has exclusive
  182. //! ownership of the mutex or abs_time is reached.
  183. //!Returns: If acquires sharable ownership, returns true. Otherwise returns false.
  184. //!Throws: interprocess_exception on error.
  185. //!
  186. //!Note: A program may deadlock if the thread that has ownership calls
  187. //! this function. If the implementation can detect the deadlock,
  188. //! an exception could be thrown
  189. template<class TimePoint>
  190. bool timed_lock_sharable(const TimePoint &abs_time);
  191. //!Same as `timed_lock_sharable`, but this function is modeled after the
  192. //!standard library interface.
  193. template<class TimePoint> bool try_lock_shared_until(const TimePoint &abs_time)
  194. { return this->timed_lock_sharable(abs_time); }
  195. //!Same as `timed_lock_sharable`, but this function is modeled after the
  196. //!standard library interface.
  197. template<class Duration> bool try_lock_shared_for(const Duration &dur)
  198. { return this->timed_lock_sharable(ipcdetail::duration_to_ustime(dur)); }
  199. //!Precondition: The thread must have sharable ownership of the mutex.
  200. //!Effects: The calling thread releases the sharable ownership of the mutex.
  201. //!Throws: An exception derived from interprocess_exception on error.
  202. void unlock_sharable();
  203. //!Same as `unlock_sharable` but with a std-compatible interface
  204. //!
  205. void unlock_shared()
  206. { this->unlock_sharable(); }
  207. //Upgradable locking
  208. //!Requires: The calling thread does not own the mutex.
  209. //!
  210. //!Effects: The calling thread tries to obtain upgradable ownership of the mutex,
  211. //! and if another thread has exclusive or upgradable ownership of the mutex,
  212. //! waits until it can obtain the ownership.
  213. //!Throws: interprocess_exception on error.
  214. //!
  215. //!Note: A program may deadlock if the thread that has ownership calls
  216. //! this function. If the implementation can detect the deadlock,
  217. //! an exception could be thrown
  218. void lock_upgradable();
  219. //!Requires: The calling thread does not own the mutex.
  220. //!
  221. //!Effects: The calling thread tries to acquire upgradable ownership of the mutex
  222. //! without waiting. If no other thread has exclusive or upgradable ownership
  223. //! of the mutex this succeeds.
  224. //!Returns: If it can acquire upgradable ownership immediately returns true.
  225. //! If it has to wait, returns false.
  226. //!Throws: interprocess_exception on error.
  227. //!
  228. //!Note: A program may deadlock if the thread that has ownership calls
  229. //! this function. If the implementation can detect the deadlock,
  230. //! an exception could be thrown
  231. bool try_lock_upgradable();
  232. //!Requires: The calling thread does not own the mutex.
  233. //!
  234. //!Effects: The calling thread tries to acquire upgradable ownership of the mutex
  235. //! waiting if necessary until no other thread has exclusive or upgradable
  236. //! ownership of the mutex or abs_time is reached.
  237. //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false.
  238. //!Throws: interprocess_exception on error.
  239. //!
  240. //!Note: A program may deadlock if the thread that has ownership calls
  241. //! this function. If the implementation can detect the deadlock,
  242. //! an exception could be thrown
  243. template<class TimePoint>
  244. bool timed_lock_upgradable(const TimePoint &abs_time);
  245. //!Precondition: The thread must have upgradable ownership of the mutex.
  246. //!Effects: The calling thread releases the upgradable ownership of the mutex.
  247. //!Throws: An exception derived from interprocess_exception on error.
  248. void unlock_upgradable();
  249. //Demotions
  250. //!Precondition: The thread must have exclusive ownership of the mutex.
  251. //!Effects: The thread atomically releases exclusive ownership and acquires
  252. //! upgradable ownership. This operation is non-blocking.
  253. //!Throws: An exception derived from interprocess_exception on error.
  254. void unlock_and_lock_upgradable();
  255. //!Precondition: The thread must have exclusive ownership of the mutex.
  256. //!Effects: The thread atomically releases exclusive ownership and acquires
  257. //! sharable ownership. This operation is non-blocking.
  258. //!Throws: An exception derived from interprocess_exception on error.
  259. void unlock_and_lock_sharable();
  260. //!Precondition: The thread must have upgradable ownership of the mutex.
  261. //!Effects: The thread atomically releases upgradable ownership and acquires
  262. //! sharable ownership. This operation is non-blocking.
  263. //!Throws: An exception derived from interprocess_exception on error.
  264. void unlock_upgradable_and_lock_sharable();
  265. //Promotions
  266. //!Precondition: The thread must have upgradable ownership of the mutex.
  267. //!Effects: The thread atomically releases upgradable ownership and acquires
  268. //! exclusive ownership. This operation will block until all threads with
  269. //! sharable ownership release it.
  270. //!Throws: An exception derived from interprocess_exception on error.
  271. void unlock_upgradable_and_lock();
  272. //!Precondition: The thread must have upgradable ownership of the mutex.
  273. //!Effects: The thread atomically releases upgradable ownership and tries to
  274. //! acquire exclusive ownership. This operation will fail if there are threads
  275. //! with sharable ownership, but it will maintain upgradable ownership.
  276. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
  277. //!Throws: An exception derived from interprocess_exception on error.
  278. bool try_unlock_upgradable_and_lock();
  279. //!Precondition: The thread must have upgradable ownership of the mutex.
  280. //!Effects: The thread atomically releases upgradable ownership and tries to acquire
  281. //! exclusive ownership, waiting if necessary until abs_time. This operation will
  282. //! fail if there are threads with sharable ownership or timeout reaches, but it
  283. //! will maintain upgradable ownership.
  284. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
  285. //!Throws: An exception derived from interprocess_exception on error.
  286. template<class TimePoint>
  287. bool timed_unlock_upgradable_and_lock(const TimePoint &abs_time);
  288. //!Precondition: The thread must have sharable ownership of the mutex.
  289. //!Effects: The thread atomically releases sharable ownership and tries to acquire
  290. //! exclusive ownership. This operation will fail if there are threads with sharable
  291. //! or upgradable ownership, but it will maintain sharable ownership.
  292. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
  293. //!Throws: An exception derived from interprocess_exception on error.
  294. bool try_unlock_sharable_and_lock();
  295. //!Precondition: The thread must have sharable ownership of the mutex.
  296. //!Effects: The thread atomically releases sharable ownership and tries to acquire
  297. //! upgradable ownership. This operation will fail if there are threads with sharable
  298. //! or upgradable ownership, but it will maintain sharable ownership.
  299. //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false.
  300. //!Throws: An exception derived from interprocess_exception on error.
  301. bool try_unlock_sharable_and_lock_upgradable();
  302. //!Erases a named upgradable mutex from the system.
  303. //!Returns false on error. Never throws.
  304. static bool remove(const char *name);
  305. #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  306. //!Erases a named upgradable mutex from the system.
  307. //!Returns false on error. Never throws.
  308. //!
  309. //!Note: This function is only available on operating systems with
  310. //! native wchar_t APIs (e.g. Windows).
  311. static bool remove(const wchar_t *name);
  312. #endif
  313. #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  314. private:
  315. friend class ipcdetail::interprocess_tester;
  316. void dont_close_on_destruction();
  317. interprocess_upgradable_mutex *mutex() const
  318. { return static_cast<interprocess_upgradable_mutex*>(m_shmem.get_user_address()); }
  319. typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
  320. open_create_impl_t m_shmem;
  321. typedef ipcdetail::named_creation_functor<interprocess_upgradable_mutex> construct_func_t;
  322. #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
  323. };
  324. #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  325. inline named_upgradable_mutex::~named_upgradable_mutex()
  326. {}
  327. inline named_upgradable_mutex::named_upgradable_mutex
  328. (create_only_t, const char *name, const permissions &perm)
  329. : m_shmem (create_only
  330. ,name
  331. ,sizeof(interprocess_upgradable_mutex) +
  332. open_create_impl_t::ManagedOpenOrCreateUserOffset
  333. ,read_write
  334. ,0
  335. ,construct_func_t(ipcdetail::DoCreate)
  336. ,perm)
  337. {}
  338. inline named_upgradable_mutex::named_upgradable_mutex
  339. (open_or_create_t, const char *name, const permissions &perm)
  340. : m_shmem (open_or_create
  341. ,name
  342. ,sizeof(interprocess_upgradable_mutex) +
  343. open_create_impl_t::ManagedOpenOrCreateUserOffset
  344. ,read_write
  345. ,0
  346. ,construct_func_t(ipcdetail::DoOpenOrCreate)
  347. ,perm)
  348. {}
  349. inline named_upgradable_mutex::named_upgradable_mutex
  350. (open_only_t, const char *name)
  351. : m_shmem (open_only
  352. ,name
  353. ,read_write
  354. ,0
  355. ,construct_func_t(ipcdetail::DoOpen))
  356. {}
  357. #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  358. inline named_upgradable_mutex::named_upgradable_mutex
  359. (create_only_t, const wchar_t *name, const permissions &perm)
  360. : m_shmem (create_only
  361. ,name
  362. ,sizeof(interprocess_upgradable_mutex) +
  363. open_create_impl_t::ManagedOpenOrCreateUserOffset
  364. ,read_write
  365. ,0
  366. ,construct_func_t(ipcdetail::DoCreate)
  367. ,perm)
  368. {}
  369. inline named_upgradable_mutex::named_upgradable_mutex
  370. (open_or_create_t, const wchar_t *name, const permissions &perm)
  371. : m_shmem (open_or_create
  372. ,name
  373. ,sizeof(interprocess_upgradable_mutex) +
  374. open_create_impl_t::ManagedOpenOrCreateUserOffset
  375. ,read_write
  376. ,0
  377. ,construct_func_t(ipcdetail::DoOpenOrCreate)
  378. ,perm)
  379. {}
  380. inline named_upgradable_mutex::named_upgradable_mutex
  381. (open_only_t, const wchar_t *name)
  382. : m_shmem (open_only
  383. ,name
  384. ,read_write
  385. ,0
  386. ,construct_func_t(ipcdetail::DoOpen))
  387. {}
  388. #endif
  389. inline void named_upgradable_mutex::dont_close_on_destruction()
  390. { ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); }
  391. inline void named_upgradable_mutex::lock()
  392. { this->mutex()->lock(); }
  393. inline void named_upgradable_mutex::unlock()
  394. { this->mutex()->unlock(); }
  395. inline bool named_upgradable_mutex::try_lock()
  396. { return this->mutex()->try_lock(); }
  397. template<class TimePoint>
  398. inline bool named_upgradable_mutex::timed_lock(const TimePoint &abs_time)
  399. { return this->mutex()->timed_lock(abs_time); }
  400. inline void named_upgradable_mutex::lock_upgradable()
  401. { this->mutex()->lock_upgradable(); }
  402. inline void named_upgradable_mutex::unlock_upgradable()
  403. { this->mutex()->unlock_upgradable(); }
  404. inline bool named_upgradable_mutex::try_lock_upgradable()
  405. { return this->mutex()->try_lock_upgradable(); }
  406. template<class TimePoint>
  407. inline bool named_upgradable_mutex::timed_lock_upgradable(const TimePoint &abs_time)
  408. { return this->mutex()->timed_lock_upgradable(abs_time); }
  409. inline void named_upgradable_mutex::lock_sharable()
  410. { this->mutex()->lock_sharable(); }
  411. inline void named_upgradable_mutex::unlock_sharable()
  412. { this->mutex()->unlock_sharable(); }
  413. inline bool named_upgradable_mutex::try_lock_sharable()
  414. { return this->mutex()->try_lock_sharable(); }
  415. template<class TimePoint>
  416. inline bool named_upgradable_mutex::timed_lock_sharable(const TimePoint &abs_time)
  417. { return this->mutex()->timed_lock_sharable(abs_time); }
  418. inline void named_upgradable_mutex::unlock_and_lock_upgradable()
  419. { this->mutex()->unlock_and_lock_upgradable(); }
  420. inline void named_upgradable_mutex::unlock_and_lock_sharable()
  421. { this->mutex()->unlock_and_lock_sharable(); }
  422. inline void named_upgradable_mutex::unlock_upgradable_and_lock_sharable()
  423. { this->mutex()->unlock_upgradable_and_lock_sharable(); }
  424. inline void named_upgradable_mutex::unlock_upgradable_and_lock()
  425. { this->mutex()->unlock_upgradable_and_lock(); }
  426. inline bool named_upgradable_mutex::try_unlock_upgradable_and_lock()
  427. { return this->mutex()->try_unlock_upgradable_and_lock(); }
  428. template<class TimePoint>
  429. inline bool named_upgradable_mutex::timed_unlock_upgradable_and_lock(const TimePoint &abs_time)
  430. { return this->mutex()->timed_unlock_upgradable_and_lock(abs_time); }
  431. inline bool named_upgradable_mutex::try_unlock_sharable_and_lock()
  432. { return this->mutex()->try_unlock_sharable_and_lock(); }
  433. inline bool named_upgradable_mutex::try_unlock_sharable_and_lock_upgradable()
  434. { return this->mutex()->try_unlock_sharable_and_lock_upgradable(); }
  435. inline bool named_upgradable_mutex::remove(const char *name)
  436. { return shared_memory_object::remove(name); }
  437. #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
  438. inline bool named_upgradable_mutex::remove(const wchar_t *name)
  439. { return shared_memory_object::remove(name); }
  440. #endif
  441. #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
  442. } //namespace interprocess {
  443. } //namespace boost {
  444. #include <boost/interprocess/detail/config_end.hpp>
  445. #endif //BOOST_INTERPROCESS_named_upgradable_mutex_HPP