void Thread::interruptibleSleep(int seconds){ LockGuard lock(mutex); if(isInterrupted){ isInterrupted = false; throw thread_interrupted(); } bool wokenUpbyInterruption = condition.waitFor(mutex, seconds); if(wokenUpbyInterruption && isInterrupted){ isInterrupted = false; throw thread_interrupted(); } }
void check_for_interruption() { if(thread_info->interrupt_requested) { thread_info->interrupt_requested=false; throw thread_interrupted(); } }
void interruption_point() { boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data(); if(thread_info && thread_info->interrupt_enabled) { lock_guard<mutex> lg(thread_info->data_mutex); if(thread_info->interrupt_requested) { thread_info->interrupt_requested=false; throw thread_interrupted(); } } }
void interruption_point() { if (this_thread_interrupt_flag.is_set()) throw thread_interrupted(); }