13 #include <rapidsmpf/utils.hpp>
41 std::function<
void()> func, Duration sleep = std::chrono::seconds{0}
106 enum State : std::uint8_t {
136 std::atomic<State> state_{State::Paused};
A thread loop that can be paused, resumed, and stopped.
PausableThreadLoop(std::function< void()> func, Duration sleep=std::chrono::seconds{0})
Constructs a thread to run the specified function in a loop.
void pause() noexcept
Pauses the execution of the thread.
bool is_running() const noexcept
Checks if the thread is currently running (not paused or stopped).
bool resume() noexcept
Resumes execution of the thread after being paused.
void pause_nb() noexcept
Pauses the execution of the thread.
bool stop() noexcept
Stops the execution of the thread and joins it.