kernel: sched: assert when k_sleep invoked from interrupt context

Fix a gap where k_sleep(K_FOREVER) could execute a code path that
would not verify that the call was not from interrupt context.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-12-12 16:07:07 -06:00 committed by Anas Nashif
commit 8162e586e3

View file

@ -1020,6 +1020,8 @@ s32_t z_impl_k_sleep(int ms)
{ {
s32_t ticks; s32_t ticks;
__ASSERT(!arch_is_in_isr(), "");
if (ms == K_FOREVER) { if (ms == K_FOREVER) {
k_thread_suspend(_current); k_thread_suspend(_current);
return K_FOREVER; return K_FOREVER;