C++ Actor Framework 0.18
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.
 
disposable schedule (time_point t, action f)
 Schedules an action for execution at a later time.
 
virtual disposable schedule_periodically (time_point first_run, action f, duration_type period)=0
 Schedules an action for periodic execution.
 
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_periodically (time_point first_run, action f, strong_actor_ptr target, duration_type period, stall_policy policy)
 Schedules an action for periodic execution by an actor.
 
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_periodically (time_point first_run, action f, weak_actor_ptr target, duration_type period, stall_policy policy)
 Schedules an action for periodic execution by an actor.
 
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]

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

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.

◆ schedule_periodically() [1/3]

virtual disposable caf::actor_clock::schedule_periodically ( time_point  first_run,
action  f,
duration_type  period 
)
pure virtual

Schedules an action for periodic execution.

Parameters
first_runThe local time at which the action should run initially.
fThe action to schedule.
periodThe time to wait between two runs. A non-positive period disables periodic execution.
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_periodically() [2/3]

disposable caf::actor_clock::schedule_periodically ( time_point  first_run,
action  f,
strong_actor_ptr  target,
duration_type  period,
stall_policy  policy 
)

Schedules an action for periodic execution by an actor.

Parameters
first_runThe local time at which the action should get enqueued to the mailbox of the target for the first time.
fThe action to schedule.
targetThe actor that should run the action.
periodThe time to wait between two messages to the actor.
policyThe strategy for dealing with a stalling target.

◆ schedule_periodically() [3/3]

disposable caf::actor_clock::schedule_periodically ( time_point  first_run,
action  f,
weak_actor_ptr  target,
duration_type  period,
stall_policy  policy 
)

Schedules an action for periodic execution by an actor.

Parameters
first_runThe local time at which the action should get enqueued to the mailbox of the target for the first time.
fThe action to schedule.
targetThe actor that should run the action.
periodThe time to wait between two messages to the actor.
policyThe strategy for dealing with a stalling target.

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