| 62 | } |
| 63 | |
| 64 | inline void condition_variable::wait(unique_lock<mutex>& m) |
| 65 | { |
| 66 | #if defined BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED |
| 67 | if(! m.owns_lock()) |
| 68 | { |
| 69 | boost::throw_exception(condition_error(-1, "boost::condition_variable::wait() failed precondition mutex not owned")); |
| 70 | } |
| 71 | #endif |
| 72 | int res=0; |
| 73 | { |
| 74 | #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS |
| 75 | thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; |
| 76 | detail::interruption_checker check_for_interruption(&internal_mutex,&cond); |
| 77 | pthread_mutex_t* the_mutex = &internal_mutex; |
| 78 | guard.activate(m); |
| 79 | res = posix::pthread_cond_wait(&cond,the_mutex); |
| 80 | check_for_interruption.unlock_if_locked(); |
| 81 | guard.deactivate(); |
| 82 | #else |
| 83 | pthread_mutex_t* the_mutex = m.mutex()->native_handle(); |
| 84 | res = posix::pthread_cond_wait(&cond,the_mutex); |
| 85 | #endif |
| 86 | } |
| 87 | #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS |
| 88 | this_thread::interruption_point(); |
| 89 | #endif |
| 90 | if(res) |
| 91 | { |
| 92 | boost::throw_exception(condition_error(res, "boost::condition_variable::wait failed in pthread_cond_wait")); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // When this function returns true: |
| 97 | // * A notification (or sometimes a spurious OS signal) has been received |
no test coverage detected