From a9c0fbd8f721900f7697e14bdb36cafce16a8083 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 27 Jan 2015 18:53:44 +0200 Subject: [PATCH] timer: add constructor from callback --- core/reactor.hh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/reactor.hh b/core/reactor.hh index 0501c77802..855add3a58 100644 --- a/core/reactor.hh +++ b/core/reactor.hh @@ -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 pollable_fd::sendto(socket_address addr, const void* buf, size_t }); } +template +inline +timer::timer(callback_t&& callback) : _callback(std::move(callback)) { +} + template inline timer::~timer() {