*/
virtual T pop() {
SGGuard<SGMutex> g(mutex);
- //if (fifo.empty()) throw NoSuchElementException();
- assert( ! this->fifo.empty() );
+ if (this->fifo.empty()) return T(); // assumes T is default constructable
+
// if (fifo.empty())
// {
// mutex.unlock();
return this->queue.size();
}
+ void waitOnNotEmpty() {
+ SGGuard<SGMutex> g(mutex);
+ while (this->queue.empty())
+ not_empty.wait(mutex);
+ }
private:
/**