Mercury Currency Engine
|
#include <chrono>
#include <condition_variable>
#include <functional>
#include <memory>
#include <thread>
#include <utility>
#include <list>
#include "function_utility.hpp"
#include "atomic.hpp"
#include "scheduler.hpp"
Go to the source code of this file.
Classes | |
struct | mce::timer_service |
struct | mce::timer_service::timer_id |
struct | mce::detail::timeout_handler_wrapper |
Typedefs | |
typedef std::chrono::steady_clock::time_point | mce::time_point |
typedef std::chrono::steady_clock::duration | mce::duration |
typedef timer_service::timer_id | mce::timer_id |
define mce::timer_id | |
Enumerations | |
enum | time_unit { hour , minute , second , millisecond , microsecond , nanosecond } |
Functions | |
mce::duration | mce::get_duration (mce::time_unit u, size_t count) |
Return duration for count units of the given time unit. | |
size_t | mce::get_time_point_difference (mce::time_unit u, mce::time_point p0, mce::time_point p1) |
Return the difference in time units between two time points. | |
mce::time_point | mce::current_time () |
Return the current time. All mce timer time operations are calculated using this function. | |
timer_service & | mce::default_timer_service () |
Access to default mce::timer_service object. | |
template<typename Callable , typename... As> | |
timer_id | mce::timer (time_unit u, size_t count, Callable &&cb, As &&... as) |
launch a timer with a Callable to be called on timeout More... | |
template<typename Callable , typename... As> | |
timer_id | mce::timer (const mce::time_point &timeout, Callable &&cb, As &&... as) |
launch a timer with a Callable to be called on timeout More... | |
template<typename Callable , typename... As> | |
timer_id | mce::timer (const mce::duration &timeout, Callable &&cb, As &&... as) |
launch a timer with a Callable to be called on timeout More... | |
bool | mce::remove_timer (timer_id id) |
remove a running timer, return true if successful, else false | |
size_t | mce::count_timers () |
return a count of running timers | |
bool | mce::sleep (mce::duration d) |
Put coroutine or thread to sleep in a blocking fashion. More... | |
bool | mce::sleep (time_unit u, size_t count) |
Put coroutine or thread to sleep in a blocking fashion. More... | |
time based operations api
|
inline |
Put coroutine or thread to sleep in a blocking fashion.
d | a duration until the coroutine should resume |
|
inline |
Put coroutine or thread to sleep in a blocking fashion.
u | time_unit used |
count | count of time_units representing time until timeout |
timer_id mce::timer | ( | const mce::duration & | timeout, |
Callable && | cb, | ||
As &&... | as | ||
) |
launch a timer with a Callable to be called on timeout
timeout | a duration until the timer will timeout |
cb | a Callable (function, Functor, lambda) to execute on timeout |
as... | optional arguments to cb |
timer_id mce::timer | ( | const mce::time_point & | timeout, |
Callable && | cb, | ||
As &&... | as | ||
) |
launch a timer with a Callable to be called on timeout
timeout | a time_point when the timer will timeout |
cb | a Callable (function, Functor, lambda) to execute on timeout |
as... | optional arguments to cb |
timer_id mce::timer | ( | time_unit | u, |
size_t | count, | ||
Callable && | cb, | ||
As &&... | as | ||
) |
launch a timer with a Callable to be called on timeout
u | time_unit used |
count | count of time_units representing time until timeout |
cb | a Callable (function, Functor, lambda) to execute on timeout |
as... | optional arguments to cb |