35 lines
507 B
C++
35 lines
507 B
C++
// TJP COPYRIGHT HEADER
|
|
|
|
//
|
|
// Timer.h
|
|
// algorithm
|
|
//
|
|
// Created by Timothy Prepscius on 1/19/18.
|
|
// Copyright © 2018 Timothy Prepscius. All rights reserved.
|
|
//
|
|
|
|
#include "Scheduler.hpp"
|
|
|
|
namespace timprepscius::core::time {
|
|
|
|
Scheduler::~Scheduler ()
|
|
{
|
|
}
|
|
|
|
Future<void> Scheduler::after(Time period)
|
|
{
|
|
Promise<void> v;
|
|
auto event = schedule(
|
|
period,
|
|
false,
|
|
[v]() {
|
|
auto r = v;
|
|
r.set_value();
|
|
}
|
|
);
|
|
|
|
return v.get_future().then([event](auto &&f) { return f.get(); });
|
|
}
|
|
|
|
} // namespace
|