1 #ifndef ERIS_EVENT_SERVICE_H 2 #define ERIS_EVENT_SERVICE_H 4 #include <sigc++/signal.h> 6 #include <boost/asio/io_service.hpp> 7 #include <boost/asio/deadline_timer.hpp> 8 #include <boost/date_time/posix_time/ptime.hpp> 9 #include <boost/noncopyable.hpp> 27 TimedEvent(
EventService& eventService,
const boost::posix_time::time_duration& duration,
const std::function<
void()>& callback);
31 boost::asio::deadline_timer* m_timer;
51 explicit EventService(boost::asio::io_service& io_service);
67 void runOnMainThread(
const std::function<
void()>& handler,
68 std::shared_ptr<bool> activeMarker = std::make_shared<bool>(
true));
77 void runOnMainThreadDelayed(
const std::function<
void()>& handler,
78 const boost::posix_time::time_duration& duration,
79 std::shared_ptr<bool> activeMarker = std::make_shared<bool>(
true));
88 size_t processAllHandlers();
97 size_t processOneHandler();
102 boost::asio::io_service& m_io_service;
103 boost::asio::io_service::work* m_work;
109 std::deque<std::function<void()>> m_handlers;
123 boost::asio::deadline_timer* createTimer();
128 size_t collectHandlersQueue();
135 #endif // of ERIS_EVENT_SERVICE_H Class for things which occur after a period of time.
Definition: EventService.h:23
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
Handles polling of the IO system as well as making sure that registered handlers are run on the main ...
Definition: EventService.h:43
A queue optimized for insertion from background threads and consumption from one main thread...
Definition: EventService.h:35