summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-24 19:12:39 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-24 19:18:05 (GMT)
commit90d6b45adf84976d99911feb3fb09b27cb6a8d1e (patch)
tree3e49f71aef78b3d95d5318ca8e1f42305628da9f /Swiften
parent442420335b9533b2a43c6e3f09758a94af045a84 (diff)
downloadswift-contrib-90d6b45adf84976d99911feb3fb09b27cb6a8d1e.zip
swift-contrib-90d6b45adf84976d99911feb3fb09b27cb6a8d1e.tar.bz2
Added debugging switch to Sluift.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp5
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.h10
2 files changed, 13 insertions, 2 deletions
diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp
index d745e39..2d71544 100644
--- a/Swiften/EventLoop/SimpleEventLoop.cpp
+++ b/Swiften/EventLoop/SimpleEventLoop.cpp
@@ -25,7 +25,7 @@ SimpleEventLoop::~SimpleEventLoop() {
}
}
-void SimpleEventLoop::run() {
+void SimpleEventLoop::doRun(bool breakAfterEvents) {
while (isRunning_) {
std::vector<Event> events;
{
@@ -38,6 +38,9 @@ void SimpleEventLoop::run() {
foreach(const Event& event, events) {
handleEvent(event);
}
+ if (breakAfterEvents) {
+ return;
+ }
}
}
diff --git a/Swiften/EventLoop/SimpleEventLoop.h b/Swiften/EventLoop/SimpleEventLoop.h
index 86195e1..bdffa3d 100644
--- a/Swiften/EventLoop/SimpleEventLoop.h
+++ b/Swiften/EventLoop/SimpleEventLoop.h
@@ -19,12 +19,20 @@ namespace Swift {
SimpleEventLoop();
~SimpleEventLoop();
- void run();
+ void run() {
+ doRun(false);
+ }
+
+ void runUntilEvents() {
+ doRun(true);
+ }
+
void stop();
virtual void post(const Event& event);
private:
+ void doRun(bool breakAfterEvents);
void doStop();
private: