diff options
Diffstat (limited to 'Swiften/EventLoop/SingleThreadedEventLoop.h')
-rw-r--r-- | Swiften/EventLoop/SingleThreadedEventLoop.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Swiften/EventLoop/SingleThreadedEventLoop.h b/Swiften/EventLoop/SingleThreadedEventLoop.h index 75ffad0..2145d652 100644 --- a/Swiften/EventLoop/SingleThreadedEventLoop.h +++ b/Swiften/EventLoop/SingleThreadedEventLoop.h @@ -36,23 +36,25 @@ namespace Swift { class SingleThreadedEventLoop : public EventLoop { public: class EventLoopCanceledException : public std::exception { }; public: SingleThreadedEventLoop(); - ~SingleThreadedEventLoop(); + virtual ~SingleThreadedEventLoop(); // Blocks while waiting for new events and returns when new events are available. // Throws EventLoopCanceledException when the wait is canceled. void waitForEvents(); void handleEvents(); void stop(); - virtual void post(const Event& event); + protected: + virtual void eventPosted(); private: bool shouldShutDown_; - std::vector<Event> events_; - boost::mutex eventsMutex_; - boost::condition_variable eventsAvailable_; + + bool eventAvailable_; + boost::mutex eventAvailableMutex_; + boost::condition_variable eventAvailableCondition_; }; } |