summaryrefslogtreecommitdiffstats
blob: 8e4b4c2a8c59d5c413090a89e5c4091d94682704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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