timer: add constructor from callback

This commit is contained in:
Avi Kivity
2015-01-27 18:53:44 +02:00
parent 5454c79613
commit a9c0fbd8f7

View File

@@ -93,6 +93,8 @@ private:
bool _queued = false;
bool _expired = false;
public:
timer() = default;
explicit timer(callback_t&& callback);
~timer();
future<> expired();
void set_callback(callback_t&& callback);
@@ -1443,6 +1445,11 @@ future<size_t> pollable_fd::sendto(socket_address addr, const void* buf, size_t
});
}
template <typename Clock>
inline
timer<Clock>::timer(callback_t&& callback) : _callback(std::move(callback)) {
}
template <typename Clock>
inline
timer<Clock>::~timer() {