diff options
| author | Liam <byteslice@airmail.cc> | 2023-12-23 14:20:10 -0500 |
|---|---|---|
| committer | Liam <byteslice@airmail.cc> | 2023-12-23 15:36:46 -0500 |
| commit | 05eda56e668f3a04c1f2600cd1a887ecd6ee1961 (patch) | |
| tree | ff2ff27b5fe665c2b7f3cd6ee06baa70139f7d32 /src/core/core_timing.h | |
| parent | 575db0417278eef0c854900885734fd068b97430 (diff) | |
core_timing: handle concurrent unscheduling of looping events
Diffstat (limited to 'src/core/core_timing.h')
| -rw-r--r-- | src/core/core_timing.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index d8cd599ee..7e4dff7f3 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -27,12 +27,15 @@ using TimedCallback = std::function<std::optional<std::chrono::nanoseconds>( /// Contains the characteristics of a particular event. struct EventType { explicit EventType(TimedCallback&& callback_, std::string&& name_) - : callback{std::move(callback_)}, name{std::move(name_)} {} + : callback{std::move(callback_)}, name{std::move(name_)}, sequence_number{0} {} /// The event's callback function. TimedCallback callback; /// A pointer to the name of the event. const std::string name; + /// A monotonic sequence number, incremented when this event is + /// changed externally. + size_t sequence_number; }; enum class UnscheduleEventType { |
