summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-26 19:36:33 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-26 22:48:01 (GMT)
commit29d5ae626df9fa0946952a78e9f1e8869ef66ae6 (patch)
treee5f3d7cbb4abfdff8b2b7b7b5fd44eaf2406b59a /Swiften/EventLoop
parentd375363472a5a4fb1f59b6e695d5c68db14d97fd (diff)
downloadswift-contrib-29d5ae626df9fa0946952a78e9f1e8869ef66ae6.zip
swift-contrib-29d5ae626df9fa0946952a78e9f1e8869ef66ae6.tar.bz2
Some more cleanups.
Diffstat (limited to 'Swiften/EventLoop')
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp11
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.h2
2 files changed, 13 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));
}
diff --git a/Swiften/EventLoop/SimpleEventLoop.h b/Swiften/EventLoop/SimpleEventLoop.h
index bdffa3d..6fb3f53 100644
--- a/Swiften/EventLoop/SimpleEventLoop.h
+++ b/Swiften/EventLoop/SimpleEventLoop.h
@@ -27,6 +27,8 @@ namespace Swift {
doRun(true);
}
+ void runOnce();
+
void stop();
virtual void post(const Event& event);