diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:24:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:25:39 +0900 |
commit | 4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch) | |
tree | fd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/thread/pthread/condition_variable.hpp | |
parent | b5c87084afaef42b2d058f68091be31988a6a874 (diff) | |
download | boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.gz boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.bz2 boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.zip |
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/thread/pthread/condition_variable.hpp')
-rw-r--r-- | boost/thread/pthread/condition_variable.hpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/boost/thread/pthread/condition_variable.hpp b/boost/thread/pthread/condition_variable.hpp index 46f49ce842..5dcb3a0e38 100644 --- a/boost/thread/pthread/condition_variable.hpp +++ b/boost/thread/pthread/condition_variable.hpp @@ -45,9 +45,17 @@ namespace boost m_.unlock(); m=&m_; } - ~lock_on_exit() + void deactivate() { - if(m) + if (m) + { + m->lock(); + } + m = 0; + } + ~lock_on_exit() BOOST_NOEXCEPT_IF(false) + { + if (m) { m->lock(); } @@ -70,10 +78,13 @@ namespace boost detail::interruption_checker check_for_interruption(&internal_mutex,&cond); pthread_mutex_t* the_mutex = &internal_mutex; guard.activate(m); + res = pthread_cond_wait(&cond,the_mutex); + check_for_interruption.check(); + guard.deactivate(); #else pthread_mutex_t* the_mutex = m.mutex()->native_handle(); -#endif res = pthread_cond_wait(&cond,the_mutex); +#endif } #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS this_thread::interruption_point(); @@ -101,10 +112,13 @@ namespace boost detail::interruption_checker check_for_interruption(&internal_mutex,&cond); pthread_mutex_t* the_mutex = &internal_mutex; guard.activate(m); + cond_res=pthread_cond_timedwait(&cond,the_mutex,&timeout); + check_for_interruption.check(); + guard.deactivate(); #else pthread_mutex_t* the_mutex = m.mutex()->native_handle(); -#endif cond_res=pthread_cond_timedwait(&cond,the_mutex,&timeout); +#endif } #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS this_thread::interruption_point(); @@ -176,6 +190,8 @@ namespace boost #endif guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); + check_for_interruption.check(); + guard.deactivate(); } #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS this_thread::interruption_point(); @@ -404,6 +420,8 @@ namespace boost #endif guard.activate(m); res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); + check_for_interruption.check(); + guard.deactivate(); } #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS this_thread::interruption_point(); |