Skip to content

Commit

Permalink
Integration with the latest CAVL version.
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Aug 22, 2024
1 parent 46a243e commit 1e1c8ff
Show file tree
Hide file tree
Showing 2 changed files with 454 additions and 185 deletions.
9 changes: 5 additions & 4 deletions include/embedded_scheduler/scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,17 @@ class Event : private cavl::Node<Event<TimePoint>>
void schedule(const TimePoint dead) noexcept
{
cancel();
deadline_ = dead; // The deadline shall be set before the event is inserted into the tree.
const auto ptr = tree_.search(
deadline_ = dead; // The deadline shall be set before the event is inserted into the tree.
const auto ptr_existing = tree_.search(
[dead](const Event& other) {
/// No two deadlines compare equal, which allows us to have multiple nodes with the same deadline in
/// the tree. With two nodes sharing the same deadline, the one added later is considered to be later.
return (dead >= other.deadline_.value()) ? +1 : -1;
},
[this] { return this; });
assert(ptr == this);
(void) ptr;
assert(std::get<0>(ptr_existing) == this);
assert(!std::get<1>(ptr_existing));
(void) ptr_existing;
}

/// The execution handler shall either reschedule or cancel the event
Expand Down
Loading

0 comments on commit 1e1c8ff

Please sign in to comment.