|
asynchrony 2.3.1
Add asynchrony to your C++ applications using standard C++20
|
Public Member Functions | |
| periodic_worker (periodic_worker &)=delete | |
| Copy constructor (deleted - workers are not copyable). | |
| auto & | operator= (periodic_worker &)=delete |
| Copy assignment operator (deleted - workers are not copyable). | |
| periodic_worker (periodic_worker &&)=delete | |
| Move constructor (deleted - workers are not movable). | |
| auto & | operator= (periodic_worker &&)=delete |
| Move assignment operator (deleted - workers are not movable). | |
| ~periodic_worker () | |
| Destructor - gracefully shuts down the periodic worker thread. | |
| void | forceCleanupTerminate (const std::source_location &sl=std::source_location::current()) |
| Force immediate termination of the worker thread. | |
| periodic_worker (std::function< void()> c, std::chrono::microseconds interval, std::string name={"anonymous-periodic-worker"}) | |
| Constructs a periodic worker thread. | |
Static Public Attributes | |
| static constexpr std::chrono::milliseconds | DEFAULT_WAIT_FOR_NEXT_ITEM_MS {1500} |
| Default wait interval for the worker thread. | |
Definition at line 102 of file periodic_worker.hpp.
|
inline |
Destructor - gracefully shuts down the periodic worker thread.
Performs the following cleanup steps:
Definition at line 138 of file periodic_worker.hpp.
|
inline |
Constructs a periodic worker thread.
Creates a single worker thread that will invoke the callback at the specified interval.
| c | The worker callback function with signature void() Called periodically at the specified interval |
| interval | The time interval between callback invocations |
| name | Optional name for the worker thread (useful for debugging) |
Definition at line 244 of file periodic_worker.hpp.
|
inline |
Force immediate termination of the worker thread.
This method should only be used during application shutdown when the callback cannot be guaranteed to be "clean" or respect the stop_token. It forcefully terminates the thread using platform-specific APIs.
| sl | Source location for logging purposes (automatically captured) |
Definition at line 194 of file periodic_worker.hpp.
|
staticconstexpr |
Default wait interval for the worker thread.
Definition at line 105 of file periodic_worker.hpp.