Skip to content

Commit f5f1744

Browse files
add missing asserts to UserAllocatedEvent class
Improves code quality by adding MBED_ASSERT to UserAllocatedEvent::delay and UserAllocatedEvent::period function. This prevent changing already posted event.
1 parent 1800632 commit f5f1744

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

events/UserAllocatedEvent.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class UserAllocatedEvent<F, void(ArgTs...)> {
215215
*/
216216
void delay(int delay)
217217
{
218+
MBED_ASSERT(!_post_ref);
218219
equeue_event_delay(&_e + 1, delay);
219220
}
220221

@@ -224,6 +225,7 @@ class UserAllocatedEvent<F, void(ArgTs...)> {
224225
*/
225226
void period(int period)
226227
{
228+
MBED_ASSERT(!_post_ref);
227229
equeue_event_period(&_e + 1, period);
228230
}
229231

0 commit comments

Comments
 (0)