comparison DEPENDENCIES/generic/include/boost/thread/pthread/thread_data.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
13 #include <boost/thread/mutex.hpp> 13 #include <boost/thread/mutex.hpp>
14 #include <boost/thread/pthread/condition_variable_fwd.hpp> 14 #include <boost/thread/pthread/condition_variable_fwd.hpp>
15 15
16 #include <boost/shared_ptr.hpp> 16 #include <boost/shared_ptr.hpp>
17 #include <boost/enable_shared_from_this.hpp> 17 #include <boost/enable_shared_from_this.hpp>
18 #include <boost/optional.hpp>
19 #include <boost/assert.hpp> 18 #include <boost/assert.hpp>
20 #ifdef BOOST_THREAD_USES_CHRONO 19 #ifdef BOOST_THREAD_USES_CHRONO
21 #include <boost/chrono/system_clocks.hpp> 20 #include <boost/chrono/system_clocks.hpp>
22 #endif 21 #endif
23 22
24 #include <map> 23 #include <map>
25 #include <vector> 24 #include <vector>
26 #include <utility> 25 #include <utility>
27 26
28 #if defined(__ANDROID__) 27 #if defined(__ANDROID__)
29 #include <asm/page.h> // http://code.google.com/p/android/issues/detail?id=39983 28 # ifndef PAGE_SIZE
29 # define PAGE_SIZE 4096
30 # endif
30 #endif 31 #endif
31 32
32 #include <pthread.h> 33 #include <pthread.h>
33 #include <unistd.h> 34 #include <unistd.h>
34 35
112 bool join_started; 113 bool join_started;
113 bool joined; 114 bool joined;
114 boost::detail::thread_exit_callback_node* thread_exit_callbacks; 115 boost::detail::thread_exit_callback_node* thread_exit_callbacks;
115 std::map<void const*,boost::detail::tss_data_node> tss_data; 116 std::map<void const*,boost::detail::tss_data_node> tss_data;
116 117
118 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
119 // These data must be at the end so that the access to the other fields doesn't change
120 // when BOOST_THREAD_PROVIDES_INTERRUPTIONS is defined.
121 // Another option is to have them always
117 pthread_mutex_t* cond_mutex; 122 pthread_mutex_t* cond_mutex;
118 pthread_cond_t* current_cond; 123 pthread_cond_t* current_cond;
124 //#endif
119 typedef std::vector<std::pair<condition_variable*, mutex*> 125 typedef std::vector<std::pair<condition_variable*, mutex*>
120 //, hidden_allocator<std::pair<condition_variable*, mutex*> > 126 //, hidden_allocator<std::pair<condition_variable*, mutex*> >
121 > notify_list_t; 127 > notify_list_t;
122 notify_list_t notify; 128 notify_list_t notify;
123 129
133 //#endif 139 //#endif
134 thread_data_base(): 140 thread_data_base():
135 thread_handle(0), 141 thread_handle(0),
136 done(false),join_started(false),joined(false), 142 done(false),join_started(false),joined(false),
137 thread_exit_callbacks(0), 143 thread_exit_callbacks(0),
144 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
138 cond_mutex(0), 145 cond_mutex(0),
139 current_cond(0), 146 current_cond(0),
147 //#endif
140 notify(), 148 notify(),
141 async_states_() 149 async_states_()
142 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS 150 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
143 , interrupt_enabled(true) 151 , interrupt_enabled(true)
144 , interrupt_requested(false) 152 , interrupt_requested(false)
218 #endif 226 #endif
219 } 227 }
220 228
221 namespace this_thread 229 namespace this_thread
222 { 230 {
223 namespace hiden 231 namespace hiden
224 { 232 {
225 void BOOST_THREAD_DECL sleep_for(const timespec& ts); 233 void BOOST_THREAD_DECL sleep_for(const timespec& ts);
226 void BOOST_THREAD_DECL sleep_until(const timespec& ts); 234 void BOOST_THREAD_DECL sleep_until(const timespec& ts);
227 } 235 }
228 236
229 #ifdef BOOST_THREAD_USES_CHRONO 237 #ifdef BOOST_THREAD_USES_CHRONO
230 #ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY 238 #ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
231 239
232 inline 240 inline
234 { 242 {
235 return boost::this_thread::hiden::sleep_for(boost::detail::to_timespec(ns)); 243 return boost::this_thread::hiden::sleep_for(boost::detail::to_timespec(ns));
236 } 244 }
237 #endif 245 #endif
238 #endif // BOOST_THREAD_USES_CHRONO 246 #endif // BOOST_THREAD_USES_CHRONO
247
248 namespace no_interruption_point
249 {
250 namespace hiden
251 {
252 void BOOST_THREAD_DECL sleep_for(const timespec& ts);
253 void BOOST_THREAD_DECL sleep_until(const timespec& ts);
254 }
255
256 #ifdef BOOST_THREAD_USES_CHRONO
257 #ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
258
259 inline
260 void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns)
261 {
262 return boost::this_thread::no_interruption_point::hiden::sleep_for(boost::detail::to_timespec(ns));
263 }
264 #endif
265 #endif // BOOST_THREAD_USES_CHRONO
266
267 } // no_interruption_point
239 268
240 void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT; 269 void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT;
241 270
242 #if defined BOOST_THREAD_USES_DATETIME 271 #if defined BOOST_THREAD_USES_DATETIME
243 #ifdef __DECXXX 272 #ifdef __DECXXX