artdaq
v3_04_00
|
The Timeout class performs registered actions at specified intervals. More...
#include <artdaq/TransferPlugins/detail/Timeout.hh>
Classes | |
struct | timeoutspec |
Specification for a Timeout function. More... | |
Public Member Functions | |
Timeout (int max_tmos=100) | |
Construct a Timeout object. More... | |
void | add_periodic (const char *desc, void *tag, std::function< void()> &function, uint64_t period_us, uint64_t start_us=0) |
Add a periodic timeout to the Timeout container. More... | |
void | add_periodic (const char *desc, void *tag, std::function< void()> &function, int rel_ms) |
Add a periodic timeout to the Timeout container. More... | |
void | add_periodic (const char *desc, uint64_t period_us, uint64_t start_us=0) |
Add a periodic timeout to the Timeout container. More... | |
void | add_relative (const char *desc, void *tag, std::function< void()> &function, int rel_ms) |
Add a periodic timeout to the Timeout container. More... | |
void | add_relative (std::string desc, int rel_ms) |
Add a periodic timeout to the Timeout container. More... | |
void | copy_in_timeout (const char *desc, uint64_t period_us, uint64_t start_us=0) |
Add a timeout with the given parameters. More... | |
bool | cancel_timeout (void *tag, std::string desc) |
Cancel the timeout having the given description and tag. More... | |
int | get_next_expired_timeout (std::string &desc, void **tag, std::function< void()> &function, uint64_t *tmo_tod_us) |
Get a timeout that has expired. More... | |
void | get_next_timeout_delay (int64_t *delay_us) |
Get the amount to wait for the next timeout to occur. More... | |
int | get_next_timeout_msdly () |
Get the amount to wait for the next timeout to occur. More... | |
bool | is_consistent () |
Run a consistency check on all confiugured timeouts. More... | |
void | list_active_time () |
TRACE all active timeouts. | |
The Timeout class performs registered actions at specified intervals.
Definition at line 22 of file Timeout.hh.
|
explicit |
Construct a Timeout object.
max_tmos | Maximum number of registered Timeout functions |
Definition at line 58 of file Timeout.cc.
void Timeout::add_periodic | ( | const char * | desc, |
void * | tag, | ||
std::function< void()> & | function, | ||
uint64_t | period_us, | ||
uint64_t | start_us = 0 |
||
) |
Add a periodic timeout to the Timeout container.
desc | Description of the periodic timeout |
tag | Tag (fd or other) to apply to timeout |
function | Function to execute at timeout |
period_us | Period for timeouts |
start_us | When to start (defaults to 0) |
maybe need to return a timeout id??
Definition at line 67 of file Timeout.cc.
void Timeout::add_periodic | ( | const char * | desc, |
void * | tag, | ||
std::function< void()> & | function, | ||
int | rel_ms | ||
) |
Add a periodic timeout to the Timeout container.
desc | Description of the periodic timeout |
tag | Tag (fd or other) to apply to timeout |
function | Function to execute at timeout |
rel_ms | Timeout in rem_ms milliseconds |
maybe need to return a timeout id??
Definition at line 82 of file Timeout.cc.
void Timeout::add_periodic | ( | const char * | desc, |
uint64_t | period_us, | ||
uint64_t | start_us = 0 |
||
) |
Add a periodic timeout to the Timeout container.
desc | Description of the periodic timeout |
period_us | Period for timeouts |
start_us | When to start (defaults to 0) |
maybe need to return a timeout id??
Definition at line 96 of file Timeout.cc.
void Timeout::add_relative | ( | const char * | desc, |
void * | tag, | ||
std::function< void()> & | function, | ||
int | rel_ms | ||
) |
Add a periodic timeout to the Timeout container.
desc | Description of the periodic timeout |
tag | Tag (fd or other) to apply to timeout |
function | Function to execute at timeout |
rel_ms | Timeout in rem_ms milliseconds |
maybe need to return a timeout id??
Definition at line 112 of file Timeout.cc.
void Timeout::add_relative | ( | std::string | desc, |
int | rel_ms | ||
) |
Add a periodic timeout to the Timeout container.
desc | Description of the periodic timeout |
rel_ms | Timeout in rem_ms milliseconds |
maybe need to return a timeout id??
Definition at line 126 of file Timeout.cc.
bool Timeout::cancel_timeout | ( | void * | tag, |
std::string | desc | ||
) |
Cancel the timeout having the given description and tag.
tag | Tag of the cancelled timeout |
desc | Description of the cancelled timeout |
Definition at line 323 of file Timeout.cc.
void Timeout::copy_in_timeout | ( | const char * | desc, |
uint64_t | period_us, | ||
uint64_t | start_us = 0 |
||
) |
Add a timeout with the given parameters.
desc | Description of new timeout |
period_us | Period that the timeout should execute with |
start_us | When to start the timeout (default 0) |
Definition at line 293 of file Timeout.cc.
int Timeout::get_next_expired_timeout | ( | std::string & | desc, |
void ** | tag, | ||
std::function< void()> & | function, | ||
uint64_t * | tmo_tod_us | ||
) |
Get a timeout that has expired.
[out] | desc | Description of timeout that expired |
[out] | tag | Tag of timeout that expired |
[out] | function | Function of timeout that expired |
[out] | tmo_tod_us | When the timeout expired |
Definition at line 140 of file Timeout.cc.
void Timeout::get_next_timeout_delay | ( | int64_t * | delay_us | ) |
Get the amount to wait for the next timeout to occur.
[out] | delay_us | Microseconds until next timeout |
Definition at line 163 of file Timeout.cc.
int Timeout::get_next_timeout_msdly | ( | ) |
Get the amount to wait for the next timeout to occur.
Definition at line 184 of file Timeout.cc.
bool Timeout::is_consistent | ( | ) |
Run a consistency check on all confiugured timeouts.
Definition at line 202 of file Timeout.cc.