21 #ifndef POSIXSHAREDQUEUE_HPP_
22 #define POSIXSHAREDQUEUE_HPP_
54 void push(
const T& data);
71 if (pthread_mutex_init(&mutex_, NULL) != 0)
72 throw std::runtime_error(std::string(
"Mutex initialization: ") +
74 if (pthread_cond_init(&empty_, NULL) != 0)
75 throw std::runtime_error(std::string(
"Condition variable initialization: ") +
101 pthread_cond_signal(&empty_);
114 while (queue_.empty())
115 if (pthread_cond_wait(&empty_, &mutex_) != 0)
116 throw std::runtime_error(std::string(
"Condition variable wait: ") +
118 T data = queue_.front();
135 std::swap(queue_, empty);
146 return queue_.size();