/*! \file eventqueue.h This is the eventqueue definition. \author Jon A. Lambert \date 05/02/2003 \version 0.30 \note Commented out semaphore code as we don't want to wait on both ends of the queue. The Server code would block on messages from main thread instead of select(). In the main thread, we will sleep \see Chat(). */ #ifndef EVENTQUEUE_H #define EVENTQUEUE_H class Event; /*! The EventQueue class implements a thread safe queue upon which Events may be pushed and popped. It is a FIFO queue. */ class EventQueue { public: EventQueue(int num_threads); ~EventQueue(); void Push(Event * event); Event * Pop(); int Size(); bool IsOk(); private: EventQueue(EventQueue&); EventQueue& operator=(EventQueue&); queue<Event*> mQue; //!< The queue of events - uses deque. CRITICAL_SECTION mMutex; //!< To enforce mutual exclusion. // bool mOk; //!< true if semaphores properly initialized. // HANDLE mFree; //!< Counting semaphore for #free. // HANDLE mUsed; //!< Counting semaphore for #used. }; #endif // EVENTQUEUE_H