/**
* A simple thread safe queue. All access functions are guarded with a mutex.
*/
-template<class T, class LOCK=SGMutex>
+template<class T, class SGLOCK=SGMutex>
class SGLockedQueue : public SGQueue<T>
{
public:
* @return bool True if queue is empty, otherwisr false.
*/
virtual bool empty() {
- SGGuard<LOCK> g(mutex);
+ SGGuard<SGLOCK> g(mutex);
return fifo.empty();
}
* @param T object to add.
*/
virtual void push( const T& item ) {
- SGGuard<LOCK> g(mutex);
+ SGGuard<SGLOCK> g(mutex);
fifo.push( item );
}
* @return T next available object.
*/
virtual T pop() {
- SGGuard<LOCK> g(mutex);
+ SGGuard<SGLOCK> g(mutex);
//if (fifo.empty()) throw NoSuchElementException();
assert( ! fifo.empty() );
// if (fifo.empty())
/**
* Mutex to serialise access.
*/
- LOCK mutex;
+ SGLOCK mutex;
private:
// Prevent copying.
/**
* Condition to signal when queue not empty.
*/
- SGCondition not_empty;
+ SGPthreadCond not_empty;
private:
// Prevent copying.