Skip to content

Commit

Permalink
add missing asserts to UserAllocatedEvent class
Browse files Browse the repository at this point in the history
Improves code quality by adding MBED_ASSERT to UserAllocatedEvent::delay
and UserAllocatedEvent::period function. This prevent changing already posted event.
  • Loading branch information
maciejbocianski committed Sep 10, 2019
1 parent 1800632 commit f5f1744
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions events/UserAllocatedEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class UserAllocatedEvent<F, void(ArgTs...)> {
*/
void delay(int delay)
{
MBED_ASSERT(!_post_ref);
equeue_event_delay(&_e + 1, delay);
}

Expand All @@ -224,6 +225,7 @@ class UserAllocatedEvent<F, void(ArgTs...)> {
*/
void period(int period)
{
MBED_ASSERT(!_post_ref);
equeue_event_period(&_e + 1, period);
}

Expand Down

0 comments on commit f5f1744

Please sign in to comment.