Share via


timer Class

A timer messaging block is a single-target source_block capable of sending a message to its target after a specified time period has elapsed or at specific intervals.

template<
   class _Type
>
class timer : public Concurrency::details::_Timer, public source_block<single_link_registry<ITarget<_Type>>>;

Parameters

  • _Type
    The payload type of the output messages of this block.

Members

Public Constructors

Name

Description

timer::timer Constructor

Overloaded. Constructs a timer messaging block that will fire a given message after a specified interval.

timer::~timer Destructor

Destroys a timer messaging block.

Public Methods

Name

Description

timer::pause Method

Stops the timer messaging block. If it is a repeating timer messaging block, it can be restarted with a subsequent start() call. For non-repeating timers, this has the same effect as a stop call.

timer::start Method

Starts the timer messaging block. The specified number of milliseconds after this is called, the specified value will be propagated downstream as a message.

timer::stop Method

Stops the timer messaging block.

Protected Methods

Name

Description

timer::accept_message Method

Accepts a message that was offered by this timer messaging block, transferring ownership to the caller.

timer::consume_message Method

Consumes a message previously offered by the timer and reserved by the target, transferring ownership to the caller.

timer::link_target_notification Method

A callback that notifies that a new target has been linked to this timer messaging block.

timer::propagate_to_any_targets Method

Tries to offer the message produced by the timer block to all of the linked targets.

timer::release_message Method

Releases a previous message reservation. (Overrides source_block::release_message.)

timer::reserve_message Method

Reserves a message previously offered by this timer messaging block. (Overrides source_block::reserve_message.)

timer::resume_propagation Method

Resumes propagation after a reservation has been released. (Overrides source_block::resume_propagation.)

Remarks

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

ISource

source_block

_Timer

timer

Requirements

Header: agents.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace