123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- #ifndef BOOST_INTERPROCESS_CONDITION_ANY_HPP
- #define BOOST_INTERPROCESS_CONDITION_ANY_HPP
- #ifndef BOOST_CONFIG_HPP
- # include <boost/config.hpp>
- #endif
- #
- #if defined(BOOST_HAS_PRAGMA_ONCE)
- # pragma once
- #endif
- #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
- #include <boost/interprocess/detail/config_begin.hpp>
- #include <boost/interprocess/detail/workaround.hpp>
- #include <boost/interprocess/sync/cv_status.hpp>
- #include <boost/interprocess/timed_utils.hpp>
- #include <boost/interprocess/sync/interprocess_mutex.hpp>
- #include <boost/interprocess/sync/interprocess_condition.hpp>
- #include <boost/interprocess/exceptions.hpp>
- #include <boost/interprocess/sync/detail/condition_any_algorithm.hpp>
- #endif
- namespace boost {
- namespace interprocess {
- class interprocess_condition_any
- {
- #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-
- interprocess_condition_any(const interprocess_condition_any &);
- interprocess_condition_any &operator=(const interprocess_condition_any &);
- class members
- {
- public:
- typedef interprocess_condition condvar_type;
- typedef interprocess_mutex mutex_type;
- condvar_type &get_condvar() { return m_cond; }
- mutex_type &get_mutex() { return m_mut; }
- private:
- condvar_type m_cond;
- mutex_type m_mut;
- };
- ipcdetail::condition_any_wrapper<members> m_cond;
- #endif
- public:
-
- interprocess_condition_any(){}
-
-
- ~interprocess_condition_any(){}
-
-
- void notify_one()
- { m_cond.notify_one(); }
-
-
- void notify_all()
- { m_cond.notify_all(); }
-
-
-
- template <typename L>
- void wait(L& lock)
- { m_cond.wait(lock); }
-
-
- template <typename L, typename Pr>
- void wait(L& lock, Pr pred)
- { m_cond.wait(lock, pred); }
-
-
-
-
-
- template <typename L, class TimePoint>
- bool timed_wait(L& lock, const TimePoint &abs_time)
- { return m_cond.timed_wait(lock, abs_time); }
-
-
-
- template <typename L, class TimePoint, typename Pr>
- bool timed_wait(L& lock, const TimePoint &abs_time, Pr pred)
- { return m_cond.timed_wait(lock, abs_time, pred); }
-
-
- template <typename L, class TimePoint>
- cv_status wait_until(L& lock, const TimePoint &abs_time)
- { return this->timed_wait(lock, abs_time) ? cv_status::no_timeout : cv_status::timeout; }
-
-
- template <typename L, class TimePoint, typename Pr>
- bool wait_until(L& lock, const TimePoint &abs_time, Pr pred)
- { return this->timed_wait(lock, abs_time, pred); }
-
-
- template <typename L, class Duration>
- cv_status wait_for(L& lock, const Duration &dur)
- { return this->wait_until(lock, ipcdetail::duration_to_ustime(dur)); }
-
-
- template <typename L, class Duration, typename Pr>
- bool wait_for(L& lock, const Duration &dur, Pr pred)
- { return this->wait_until(lock, ipcdetail::duration_to_ustime(dur), pred); }
- };
- }
- }
- #include <boost/interprocess/detail/config_end.hpp>
- #endif
|