summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/EventLoop/DummyEventLoop.cpp')
-rw-r--r--Swiften/EventLoop/DummyEventLoop.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/Swiften/EventLoop/DummyEventLoop.cpp b/Swiften/EventLoop/DummyEventLoop.cpp
index b8e631e..3675ead 100644
--- a/Swiften/EventLoop/DummyEventLoop.cpp
+++ b/Swiften/EventLoop/DummyEventLoop.cpp
@@ -10,16 +10,30 @@
namespace Swift {
-DummyEventLoop::DummyEventLoop() {
+DummyEventLoop::DummyEventLoop() : hasEvents_(false) {
}
DummyEventLoop::~DummyEventLoop() {
- boost::lock_guard<boost::mutex> lock(eventsMutex_);
- if (!events_.empty()) {
+ if (hasEvents()) {
std::cerr << "DummyEventLoop: Unhandled events at destruction time" << std::endl;
}
- events_.clear();
}
+void DummyEventLoop::processEvents() {
+ while(hasEvents()) {
+ hasEvents_ = false;
+ handleNextEvent();
+ }
+}
+
+bool DummyEventLoop::hasEvents() {
+ boost::lock_guard<boost::mutex> lock(hasEventsMutex_);
+ return hasEvents_;
+}
+
+void DummyEventLoop::eventPosted() {
+ boost::lock_guard<boost::mutex> lock(hasEventsMutex_);
+ hasEvents_ = true;
+}
}