summaryrefslogtreecommitdiff
path: root/boost/interprocess/sync/named_condition.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/interprocess/sync/named_condition.hpp')
-rw-r--r--boost/interprocess/sync/named_condition.hpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/boost/interprocess/sync/named_condition.hpp b/boost/interprocess/sync/named_condition.hpp
index c5529eda6c..ca0205ad73 100644
--- a/boost/interprocess/sync/named_condition.hpp
+++ b/boost/interprocess/sync/named_condition.hpp
@@ -22,7 +22,12 @@
#include <boost/interprocess/detail/interprocess_tester.hpp>
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-#include <boost/interprocess/sync/shm/named_condition.hpp>
+#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS)
+ #include <boost/interprocess/sync/windows/named_condition.hpp>
+ #define BOOST_INTERPROCESS_USE_WINDOWS
+#else
+ #include <boost/interprocess/sync/shm/named_condition.hpp>
+#endif
//!\file
//!Describes a named condition class for inter-process synchronization
@@ -50,7 +55,7 @@ class named_condition
//!If the condition can't be created throws interprocess_exception
named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions());
- //!Opens or creates a global condition with a name.
+ //!Opens or creates a global condition with a name.
//!If the condition is created, this call is equivalent to
//!named_condition(create_only_t, ... )
//!If the condition is already created, this call is equivalent
@@ -71,7 +76,7 @@ class named_condition
//!use remove().
~named_condition();
- //!If there is a thread waiting on *this, change that
+ //!If there is a thread waiting on *this, change that
//!thread's state to ready. Otherwise there is no effect.*/
void notify_one();
@@ -79,8 +84,8 @@ class named_condition
//!If there are no waiting threads, notify_all() has no effect.
void notify_all();
- //!Releases the lock on the named_mutex object associated with lock, blocks
- //!the current thread of execution until readied by a call to
+ //!Releases the lock on the named_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
//!this->notify_one() or this->notify_all(), and then reacquires the lock.
template <typename L>
void wait(L& lock);
@@ -90,16 +95,16 @@ class named_condition
template <typename L, typename Pr>
void wait(L& lock, Pr pred);
- //!Releases the lock on the named_mutex object associated with lock, blocks
- //!the current thread of execution until readied by a call to
- //!this->notify_one() or this->notify_all(), or until time abs_time is reached,
+ //!Releases the lock on the named_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), or until time abs_time is reached,
//!and then reacquires the lock.
//!Returns: false if time abs_time is reached, otherwise true.
template <typename L>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time);
- //!The same as: while (!pred()) {
- //! if (!timed_wait(lock, abs_time)) return pred();
+ //!The same as: while (!pred()) {
+ //! if (!timed_wait(lock, abs_time)) return pred();
//! } return true;
template <typename L, typename Pr>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred);
@@ -110,7 +115,12 @@ class named_condition
/// @cond
private:
- ipcdetail::shm_named_condition m_cond;
+ #if defined(BOOST_INTERPROCESS_USE_WINDOWS)
+ typedef ipcdetail::windows_named_condition condition_type;
+ #else
+ typedef ipcdetail::shm_named_condition condition_type;
+ #endif
+ condition_type m_cond;
friend class ipcdetail::interprocess_tester;
void dont_close_on_destruction()
@@ -160,7 +170,7 @@ inline bool named_condition::timed_wait
{ return m_cond.timed_wait(lock, abs_time, pred); }
inline bool named_condition::remove(const char *name)
-{ return ipcdetail::shm_named_condition::remove(name); }
+{ return condition_type::remove(name); }
/// @endcond