inline void condition_variable::wait(unique_lock<mutex>& m) { int res=0; { thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); } this_thread::interruption_point(); if(res) { boost::throw_exception(condition_error()); } }
void wait(lock_type& m) { int res=0; { thread_cv_detail::lock_on_exit<lock_type> guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); } this_thread::interruption_point(); if(res) { boost::throw_exception(condition_error()); } }
void wait(lock_type& m) { int res=0; { detail::interruption_checker check_for_interruption(&cond); { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); m.unlock(); res=pthread_cond_wait(&cond,&internal_mutex); } m.lock(); } if(res) { boost::throw_exception(condition_error()); } }
inline bool condition_variable::timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until) { thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; int cond_res; { detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); struct timespec const timeout=detail::get_timespec(wait_until); cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); } this_thread::interruption_point(); if(cond_res==ETIMEDOUT) { return false; } if(cond_res) { boost::throw_exception(condition_error()); } return true; }
bool timed_wait(lock_type& m,boost::system_time const& wait_until) { struct timespec const timeout=detail::get_timespec(wait_until); int res=0; { thread_cv_detail::lock_on_exit<lock_type> guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); } this_thread::interruption_point(); if(res==ETIMEDOUT) { return false; } if(res) { boost::throw_exception(condition_error()); } return true; }
bool timed_wait(lock_type& m,boost::system_time const& wait_until) { struct timespec const timeout=detail::get_timespec(wait_until); int res=0; { detail::interruption_checker check_for_interruption(&cond); { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); m.unlock(); res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); } m.lock(); } if(res==ETIMEDOUT) { return false; } if(res) { boost::throw_exception(condition_error()); } return true; }