diff options
Diffstat (limited to 'Swiften/Network/Timer.h')
-rw-r--r-- | Swiften/Network/Timer.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/Network/Timer.h b/Swiften/Network/Timer.h new file mode 100644 index 0000000..8e4b4c2 --- /dev/null +++ b/Swiften/Network/Timer.h @@ -0,0 +1,31 @@ +#ifndef SWIFTEN_Timer_H +#define SWIFTEN_Timer_H + +#include <boost/asio.hpp> +#include <boost/signals.hpp> +#include <boost/thread.hpp> + +namespace Swift { + class Timer { + public: + Timer(int milliseconds); + ~Timer(); + + void start(); + + public: + boost::signal<void ()> onTick; + + private: + void doStart(); + void handleTimerTick(); + + private: + int timeout_; + boost::asio::io_service* ioService_; + boost::thread* thread_; + boost::asio::deadline_timer* timer_; + }; +} + +#endif |