bool pop_front(T& ret) { // will wait until there is an element to return
pthread_mutex_lock(&m_queue_lock);
if (m_queue.empty()) {
pthread_cond_wait(&m_event_cond, &m_queue_lock);
}
if (m_queue.empty()) return false; // signalled without an addition to the container
ret = m_queue.front();
pthread_mutex_unlock(&m_queue_lock);
return true;
}
basically blocking pop_front in pthread.