stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
system_timer.hpp File Reference

System timer / delayed execution (platform run loop or portable thread). More...

#include <cassert>
#include <stlab/config.hpp>
#include <stlab/pre_exit.hpp>
#include <chrono>
#include <type_traits>
#include <stlab/concurrency/task.hpp>

Go to the source code of this file.

Variables

constexpr auto stlab::system_timer
 Schedules void() noexcept tasks on a system timer / run loop (platform-dependent).

Detailed Description

System timer / delayed execution (platform run loop or portable thread).

system_timer schedules void() noexcept tasks after a delay. The implementation is platform-specific (Grand Central Dispatch, Windows thread-pool timers, or a portable thread with a priority queue).

Destroying a system_timer does not tear down the underlying run loop or timer thread; tasks already submitted still run. On libdispatch builds, scheduling after pre_exit() is ignored.

Prefer std::chrono::duration overloads. Deprecated time_point overloads run immediately if the time is in the past. If a prior task overruns its interval, later tasks may run later than requested (never earlier).