kernel: fix issues in idle thread
- Add missing irq_lock() before invoking power management. - Only yield if the idle thread is a coop thread (in coop-only configurations). Change-Id: I030795e782590b3023f1d7883bbd058da2c45f4f Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
fab8d92936
commit
8450c903be
1 changed files with 8 additions and 1 deletions
|
@ -127,6 +127,12 @@ void _sys_power_save_idle_exit(int32_t ticks)
|
|||
}
|
||||
|
||||
|
||||
#if K_IDLE_PRIO < 0
|
||||
#define IDLE_YIELD_IF_COOP() k_yield()
|
||||
#else
|
||||
#define IDLE_YIELD_IF_COOP() do { } while ((0))
|
||||
#endif
|
||||
|
||||
void idle(void *unused1, void *unused2, void *unused3)
|
||||
{
|
||||
ARG_UNUSED(unused1);
|
||||
|
@ -142,8 +148,9 @@ void idle(void *unused1, void *unused2, void *unused3)
|
|||
#endif
|
||||
|
||||
for (;;) {
|
||||
(void)irq_lock();
|
||||
_sys_power_save_idle(_get_next_timeout_expiry());
|
||||
|
||||
k_yield();
|
||||
IDLE_YIELD_IF_COOP();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue