named_upgradable_mutex.hpp 22 KB

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