ros2_control - rolling
Loading...
Searching...
No Matches
ros2_control::CompletedExecutionRecord Class Reference

Latest completed execution (e.g. an async read or write cycle) and its duration, published by one thread and consumed by another one without locking. More...

#include <statistics_types.hpp>

Classes

struct  Execution
 A completed execution. More...

Public Member Functions

void publish (std::chrono::nanoseconds duration)
 Publish a completed execution that lasted duration.
std::optional< Execution > consume_new ()
void discard ()
 Mark the latest completed execution as consumed, e.g. so it isn't reported after a restart.

Detailed Description

Latest completed execution (e.g. an async read or write cycle) and its duration, published by one thread and consumed by another one without locking.

Each completed execution is consumed at most once, and a consumed duration always belongs to the execution it is reported for: the duration and its sequence number are published together through a sequence lock. Executions published between two consume_new() calls but the latest are skipped.

publish() may only be called from a single thread, and consume_new() and discard() from a single (possibly different) thread.

Member Function Documentation

◆ consume_new()

std::optional< Execution > ros2_control::CompletedExecutionRecord::consume_new ( )
inline

Return the latest completed execution if it was not consumed yet, otherwise std::nullopt. Also returns std::nullopt if an execution is being published concurrently; it is then returned by a later call.


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