Esempio n. 1
0
 bool synchronized_await(Mutex& mtx, CondVar& cv, const TimePoint& timeout) {
   CAF_ASSERT(!closed());
   if (try_block()) {
     std::unique_lock<Mutex> guard(mtx);
     while (blocked()) {
       if (cv.wait_until(guard, timeout) == std::cv_status::timeout) {
         // if we're unable to set the queue from blocked to empty,
         // than there's a new element in the list
         return !try_unblock();
       }
     }
   }
   return true;
 }