2015-04-23 16:07:22 +00:00
|
|
|
// Copyright (c) 2011-2015 The Cryptonote developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2014-09-15 10:48:45 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
2015-04-06 16:13:07 +00:00
|
|
|
namespace System {
|
|
|
|
|
|
|
|
class Dispatcher;
|
2014-09-15 10:48:45 +00:00
|
|
|
|
|
|
|
class Timer {
|
|
|
|
public:
|
|
|
|
Timer();
|
2015-04-06 16:13:07 +00:00
|
|
|
explicit Timer(Dispatcher& dispatcher);
|
2014-09-15 10:48:45 +00:00
|
|
|
Timer(const Timer&) = delete;
|
|
|
|
Timer(Timer&& other);
|
|
|
|
~Timer();
|
|
|
|
Timer& operator=(const Timer&) = delete;
|
|
|
|
Timer& operator=(Timer&& other);
|
2015-05-27 12:08:46 +00:00
|
|
|
void sleep(std::chrono::nanoseconds duration);
|
2014-09-15 10:48:45 +00:00
|
|
|
|
|
|
|
private:
|
2015-04-06 16:13:07 +00:00
|
|
|
Dispatcher* dispatcher;
|
|
|
|
void* context;
|
2015-05-27 12:08:46 +00:00
|
|
|
int timer;
|
2014-09-15 10:48:45 +00:00
|
|
|
};
|
2015-04-06 16:13:07 +00:00
|
|
|
|
|
|
|
}
|