summaryrefslogtreecommitdiffstats
blob: 6474fe9302e4d0e0bdc5d88fee77df0411257b8e (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
#pragma once

#include <boost/asio.hpp>
#include <boost/signals.hpp>
#include <boost/thread.hpp>
#include <boost/enable_shared_from_this.hpp>

#include "Swiften/EventLoop/EventOwner.h"

namespace Swift {
	class Timer : public EventOwner, public boost::enable_shared_from_this<Timer> {
		public:
			Timer(int milliseconds, boost::asio::io_service* service);
			~Timer();

			void start();
			void stop();

		public:
			boost::signal<void ()> onTick;

		private:
			void handleTimerTick(const boost::system::error_code& error);

		private:
			int timeout;
			boost::asio::deadline_timer timer;
	};
}