C++ Actor Framework 0.19
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
caf::actor_clock Class Referenceabstract

A monotonic clock for scheduling timeouts and delayed messages. More...

#include <actor_clock.hpp>

Inherited by caf::detail::test_actor_clock, and caf::detail::thread_safe_actor_clock.

Public Types

enum class  stall_policy {
  fail ,
  skip
}
 Configures how the clock responds to a stalling actor when trying to schedule a periodic action. More...
 
using clock_type = std::chrono::steady_clock
 Underlying clock type.
 
using time_point = typename clock_type::time_point
 Discrete point in time.
 
using duration_type = typename clock_type::duration
 Time interval.
 

Public Member Functions

virtual time_point now () const noexcept
 Returns the current wall-clock time.
 
disposable schedule (action f)
 Schedules an action for execution.
 
virtual disposable schedule (time_point t, action f)=0
 Schedules an action for execution at a later time.
 
disposable schedule (time_point t, action f, strong_actor_ptr target)
 Schedules an action for execution by an actor at a later time.
 
disposable schedule (time_point t, action f, weak_actor_ptr target)
 Schedules an action for execution by an actor at a later time.
 
disposable schedule_message (time_point t, strong_actor_ptr receiver, mailbox_element_ptr content)
 Schedules an arbitrary message to receiver for time point t.
 
disposable schedule_message (time_point t, weak_actor_ptr receiver, mailbox_element_ptr content)
 Schedules an arbitrary message to receiver for time point t.
 
disposable schedule_message (time_point t, group target, strong_actor_ptr sender, message content)
 Schedules an arbitrary message to target for time point t.
 

Detailed Description

A monotonic clock for scheduling timeouts and delayed messages.

Member Enumeration Documentation

◆ stall_policy

enum class caf::actor_clock::stall_policy
strong

Configures how the clock responds to a stalling actor when trying to schedule a periodic action.

Enumerator
skip 

Causes the clock to dispose an action send an error to the actor.

Member Function Documentation

◆ schedule() [1/4]

disposable caf::actor_clock::schedule ( action  f)

Schedules an action for execution.

Parameters
fThe action to schedule.
Note
The action runs on the thread of the clock worker and thus must complete within a very short time in order to not delay other work.

◆ schedule() [2/4]

virtual disposable caf::actor_clock::schedule ( time_point  t,
action  f 
)
pure virtual

Schedules an action for execution at a later time.

Parameters
tThe local time at which the action should run.
fThe action to schedule.
Note
The action runs on the thread of the clock worker and thus must complete within a very short time in order to not delay other work.

◆ schedule() [3/4]

disposable caf::actor_clock::schedule ( time_point  t,
action  f,
strong_actor_ptr  target 
)

Schedules an action for execution by an actor at a later time.

Parameters
tThe local time at which the action should get enqueued to the mailbox of the target.
fThe action to schedule.
targetThe actor that should run the action.

◆ schedule() [4/4]

disposable caf::actor_clock::schedule ( time_point  t,
action  f,
weak_actor_ptr  target 
)

Schedules an action for execution by an actor at a later time.

Parameters
targetThe actor that should run the action.
fThe action to schedule.
tThe local time at which the action should get enqueued to the mailbox of the target.

The documentation for this class was generated from the following file: