summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/EventLoop/SimpleEventLoop.h')
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/Swiften/EventLoop/SimpleEventLoop.h b/Swiften/EventLoop/SimpleEventLoop.h
index da1c039..fe5f509 100644
--- a/Swiften/EventLoop/SimpleEventLoop.h
+++ b/Swiften/EventLoop/SimpleEventLoop.h
@@ -1,47 +1,47 @@
/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Copyright (c) 2010-2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
*/
#pragma once
-#include <vector>
-#include <boost/function.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+#include <condition_variable>
+#include <mutex>
#include <Swiften/Base/API.h>
#include <Swiften/EventLoop/EventLoop.h>
namespace Swift {
- class SWIFTEN_API SimpleEventLoop : public EventLoop {
- public:
- SimpleEventLoop();
- ~SimpleEventLoop();
+ class SWIFTEN_API SimpleEventLoop : public EventLoop {
+ public:
+ SimpleEventLoop();
+ virtual ~SimpleEventLoop();
- void run() {
- doRun(false);
- }
+ void run() {
+ doRun(false);
+ }
- void runUntilEvents() {
- doRun(true);
- }
+ void runUntilEvents() {
+ doRun(true);
+ }
- void runOnce();
+ void runOnce();
- void stop();
+ void stop();
- virtual void post(const Event& event);
+ protected:
+ virtual void eventPosted();
- private:
- void doRun(bool breakAfterEvents);
- void doStop();
+ private:
+ void doRun(bool breakAfterEvents);
+ void doStop();
- private:
- bool isRunning_;
- std::vector<Event> events_;
- boost::mutex eventsMutex_;
- boost::condition_variable eventsAvailable_;
- };
+ private:
+ bool isRunning_;
+
+ bool eventAvailable_;
+ std::mutex eventAvailableMutex_;
+ std::condition_variable eventAvailableCondition_;
+ };
}