C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
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 (std::nullptr_t, strong_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message to receiver as an anonymous message that shall be delivered when timeout has expired.
 
disposable schedule_message (std::nullptr_t, weak_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message to receiver as an anonymous message that shall be delivered when timeout has expired.
 
disposable schedule_message (strong_actor_ptr sender, strong_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message from sender to receiver that shall be delivered when timeout has expired.
 
disposable schedule_message (strong_actor_ptr sender, weak_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message from sender to receiver that shall be delivered when timeout has expired.
 
disposable schedule_message (weak_actor_ptr sender, strong_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message from sender to receiver that shall be delivered when timeout has expired.
 
disposable schedule_message (weak_actor_ptr sender, weak_actor_ptr receiver, time_point timeout, message_id mid, message content)
 Schedules an arbitrary message from sender to receiver that shall be delivered when timeout has expired.
 

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 files: