kernel: events: prevent k_event_init() from being called in an ISR
Most kernel objects should be initialized well before being manipulated in ISR context. Event objects are no exception. Initializing a k_event object in ISR context would implicitly be racey and introduce an element of non-determinism. Assert that k_event_init() is not called from ISR context. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
c10e6eaf07
commit
36c44045a0
1 changed files with 2 additions and 0 deletions
|
@ -51,6 +51,8 @@ static struct k_obj_type obj_type_event;
|
|||
|
||||
void z_impl_k_event_init(struct k_event *event)
|
||||
{
|
||||
__ASSERT_NO_MSG(!arch_is_in_isr());
|
||||
|
||||
event->events = 0;
|
||||
event->lock = (struct k_spinlock) {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue