Skip to content

Commit

Permalink
[eclipse-iceoryx#264] Restrict event id max value
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Jul 14, 2024
1 parent c12de7d commit 3d1ddcc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/cxx/event/src/notifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ auto main() -> int {
.event()
.open_or_create()
.expect("successful service creation/opening");
auto max_event_id = service.static_config().event_id_max_value();

auto notifier = service.notifier_builder().create().expect("successful notifier creation");

auto counter = 0;
while (node.wait(CYCLE_TIME) == NodeEvent::Tick) {
counter += 1;
notifier.notify_with_custom_event_id(EventId(counter)).expect("notification");
notifier.notify_with_custom_event_id(EventId(counter % max_event_id)).expect("notification");

std::cout << "Trigger event with id " << counter << "..." << std::endl;
}
Expand Down

0 comments on commit 3d1ddcc

Please sign in to comment.