Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/interprocess/sync/windows/condition.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 | |
11 #ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP | |
12 #define BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP | |
13 | |
14 #include <boost/interprocess/detail/config_begin.hpp> | |
15 #include <boost/interprocess/detail/workaround.hpp> | |
16 #include <boost/interprocess/detail/posix_time_types_wrk.hpp> | |
17 | |
18 #include <boost/interprocess/sync/interprocess_mutex.hpp> | |
19 #include <boost/interprocess/sync/scoped_lock.hpp> | |
20 #include <boost/interprocess/exceptions.hpp> | |
21 #include <boost/interprocess/sync/windows/semaphore.hpp> | |
22 #include <boost/interprocess/sync/windows/mutex.hpp> | |
23 #include <boost/interprocess/sync/detail/condition_algorithm_8a.hpp> | |
24 | |
25 | |
26 namespace boost { | |
27 namespace interprocess { | |
28 namespace ipcdetail { | |
29 | |
30 class windows_condition | |
31 { | |
32 windows_condition(const windows_condition &); | |
33 windows_condition &operator=(const windows_condition &); | |
34 | |
35 public: | |
36 windows_condition() | |
37 : m_condition_data() | |
38 {} | |
39 | |
40 ~windows_condition() | |
41 {} | |
42 | |
43 void notify_one() | |
44 { m_condition_data.notify_one(); } | |
45 | |
46 void notify_all() | |
47 { m_condition_data.notify_all(); } | |
48 | |
49 template <typename L> | |
50 bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) | |
51 { return m_condition_data.timed_wait(lock, abs_time); } | |
52 | |
53 template <typename L, typename Pr> | |
54 bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) | |
55 { return m_condition_data.timed_wait(lock, abs_time, pred); } | |
56 | |
57 template <typename L> | |
58 void wait(L& lock) | |
59 { m_condition_data.wait(lock); } | |
60 | |
61 template <typename L, typename Pr> | |
62 void wait(L& lock, Pr pred) | |
63 { m_condition_data.wait(lock, pred); } | |
64 | |
65 private: | |
66 | |
67 struct condition_data | |
68 { | |
69 typedef boost::int32_t integer_type; | |
70 typedef windows_semaphore semaphore_type; | |
71 typedef windows_mutex mutex_type; | |
72 | |
73 condition_data() | |
74 : m_nwaiters_blocked(0) | |
75 , m_nwaiters_gone(0) | |
76 , m_nwaiters_to_unblock(0) | |
77 , m_sem_block_queue(0) | |
78 , m_sem_block_lock(1) | |
79 , m_mtx_unblock_lock() | |
80 {} | |
81 | |
82 integer_type &get_nwaiters_blocked() | |
83 { return m_nwaiters_blocked; } | |
84 | |
85 integer_type &get_nwaiters_gone() | |
86 { return m_nwaiters_gone; } | |
87 | |
88 integer_type &get_nwaiters_to_unblock() | |
89 { return m_nwaiters_to_unblock; } | |
90 | |
91 semaphore_type &get_sem_block_queue() | |
92 { return m_sem_block_queue; } | |
93 | |
94 semaphore_type &get_sem_block_lock() | |
95 { return m_sem_block_lock; } | |
96 | |
97 mutex_type &get_mtx_unblock_lock() | |
98 { return m_mtx_unblock_lock; } | |
99 | |
100 boost::int32_t m_nwaiters_blocked; | |
101 boost::int32_t m_nwaiters_gone; | |
102 boost::int32_t m_nwaiters_to_unblock; | |
103 windows_semaphore m_sem_block_queue; | |
104 windows_semaphore m_sem_block_lock; | |
105 windows_mutex m_mtx_unblock_lock; | |
106 }; | |
107 | |
108 ipcdetail::condition_8a_wrapper<condition_data> m_condition_data; | |
109 }; | |
110 | |
111 } //namespace ipcdetail | |
112 } //namespace interprocess | |
113 } //namespace boost | |
114 | |
115 #include <boost/interprocess/detail/config_end.hpp> | |
116 | |
117 #endif //BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP |