diff options
Diffstat (limited to 'Swiften/EventLoop/BoostASIOEventLoop.h')
-rw-r--r-- | Swiften/EventLoop/BoostASIOEventLoop.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Swiften/EventLoop/BoostASIOEventLoop.h b/Swiften/EventLoop/BoostASIOEventLoop.h new file mode 100644 index 0000000..fbdf443 --- /dev/null +++ b/Swiften/EventLoop/BoostASIOEventLoop.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#pragma once + +#include <memory> +#include <mutex> + +#include <boost/asio/io_service.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/EventLoop/Event.h> +#include <Swiften/EventLoop/EventLoop.h> + +namespace Swift { + class SWIFTEN_API BoostASIOEventLoop : public EventLoop { + public: + BoostASIOEventLoop(std::shared_ptr<boost::asio::io_service> ioService); + virtual ~BoostASIOEventLoop(); + + protected: + void handleASIOEvent(); + + virtual void eventPosted(); + + private: + std::shared_ptr<boost::asio::io_service> ioService_; + + bool isEventInASIOEventLoop_ = false; + std::recursive_mutex isEventInASIOEventLoopMutex_; + }; +} |