cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::executors::Timer Class Reference

Class of timers to call functions later. More...

#include <msgpack_rpc/executors/timer.h>

Collaboration diagram for msgpack_rpc::executors::Timer:

Public Member Functions

 Timer (const std::shared_ptr< IExecutor > &executor, OperationType type)
 Constructor.
template<typename Function>
void async_sleep_for (std::chrono::steady_clock::duration duration, Function &&function)
 Asynchronously sleep for a duration.
template<typename Function>
void async_sleep_until (std::chrono::steady_clock::time_point time, Function &&function)
 Asynchronously sleep until a time point.
void cancel ()
 Cancel this timer.

Private Attributes

asio::steady_timer timer_
 Timer in asio library.

Detailed Description

Class of timers to call functions later.

Definition at line 37 of file timer.h.

Constructor & Destructor Documentation

◆ Timer()

msgpack_rpc::executors::Timer::Timer ( const std::shared_ptr< IExecutor > & executor,
OperationType type )
inline

Constructor.

Parameters
[in]executorExecutor.
[in]typeType of the operation.

Definition at line 45 of file timer.h.

Member Function Documentation

◆ async_sleep_for()

template<typename Function>
void msgpack_rpc::executors::Timer::async_sleep_for ( std::chrono::steady_clock::duration duration,
Function && function )
inline

Asynchronously sleep for a duration.

Template Parameters
FunctionType of the function.
Parameters
[in]durationDuration.
[in]functionFunction called when the time come.

Definition at line 75 of file timer.h.

◆ async_sleep_until()

template<typename Function>
void msgpack_rpc::executors::Timer::async_sleep_until ( std::chrono::steady_clock::time_point time,
Function && function )
inline

Asynchronously sleep until a time point.

Template Parameters
FunctionType of the function.
Parameters
[in]timeTime point.
[in]functionFunction called when the time come.

Definition at line 56 of file timer.h.

◆ cancel()

void msgpack_rpc::executors::Timer::cancel ( )
inline

Cancel this timer.

Definition at line 89 of file timer.h.

Member Data Documentation

◆ timer_

asio::steady_timer msgpack_rpc::executors::Timer::timer_
private

Timer in asio library.

Definition at line 93 of file timer.h.


The documentation for this class was generated from the following file:
  • src/msgpack_rpc/executors/timer.h