diff options
Diffstat (limited to 'Swiften/EventLoop/SimpleEventLoop.cpp')
-rw-r--r-- | Swiften/EventLoop/SimpleEventLoop.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp index 2d71544..b77639c 100644 --- a/Swiften/EventLoop/SimpleEventLoop.cpp +++ b/Swiften/EventLoop/SimpleEventLoop.cpp @@ -44,6 +44,17 @@ void SimpleEventLoop::doRun(bool breakAfterEvents) { } } +void SimpleEventLoop::runOnce() { + std::vector<Event> events; + { + boost::unique_lock<boost::mutex> lock(eventsMutex_); + events.swap(events_); + } + foreach(const Event& event, events) { + handleEvent(event); + } +} + void SimpleEventLoop::stop() { postEvent(boost::bind(&SimpleEventLoop::doStop, this)); } |