Пример #1
0
 bool empty() const
 {
   TRACE;
   std::unique_lock<std::mutex> lock(m_mutex);
   if (m_cancelled) throw CancelledException();
   return m_queue.empty();
 }
Пример #2
0
void
Foo_C_cust_op2::result(void)
{
  if (this->cancelled_)
    {
      throw CancelledException();
    }
}
Пример #3
0
 void push(const T& value)
 {
   TRACE;
   std::unique_lock<std::mutex> lock(m_mutex);
   if (m_cancelled) throw CancelledException();
   m_queue.push_back(value);
   m_condVar.notify_one();
 }
Пример #4
0
void
Foo_C_cust_op5::result(void)
{
  if (this->cancelled_)
    {
      throw CancelledException();
    }

  if (this->exception_)
    {
      throw CustomException();
    }
}
Пример #5
0
  T waitAndPop()
  {
    TRACE;
    std::unique_lock<std::mutex> lock(m_mutex);

    while (m_queue.empty() && !m_cancelled)
      m_condVar.wait(lock);

    if (m_cancelled) throw CancelledException();

    T retVal = m_queue.front();
    m_queue.pop_front();
    return retVal;
  }