kernel: fix race condition when spawning a thread with a delay
Interrupt must be locked before inserting a timeout in the timeout queue. Change-Id: Iab0bf01f393e66a6403d2f85e899dbf737da4afc Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
cb21e03ebb
commit
f421ec23ad
1 changed files with 2 additions and 0 deletions
|
@ -221,8 +221,10 @@ static void schedule_new_thread(struct k_thread *thread, int32_t delay)
|
|||
start_thread(thread);
|
||||
} else {
|
||||
int32_t ticks = _TICK_ALIGN + _ms_to_ticks(delay);
|
||||
int key = irq_lock();
|
||||
|
||||
_add_thread_timeout(thread, NULL, ticks);
|
||||
irq_unlock(key);
|
||||
}
|
||||
#else
|
||||
ARG_UNUSED(delay);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue