core_timing: handle concurrent unscheduling of looping events

This commit is contained in:
Liam 2023-12-23 14:20:10 -05:00
parent 575db04172
commit 05eda56e66
2 changed files with 15 additions and 4 deletions

View file

@ -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 {