sys_clock: Lock interrupts when processing announced ticks

Interrupts must be locked when processing announced ticks in
_nano_sys_clock_tick_announce().  This prevents higher priority
interrupts from interrupting the tick announcement and possibly
corrupting the timeout and/or timer queues.

Change-Id: I4e87fc5b3ad36161e0accb50b2691f975f5877e5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2016-01-29 11:30:20 -05:00 committed by Anas Nashif
commit 61e6f4a299

View file

@ -201,9 +201,13 @@ static inline void handle_expired_nano_timers(int ticks)
*/ */
void _nano_sys_clock_tick_announce(int32_t ticks) void _nano_sys_clock_tick_announce(int32_t ticks)
{ {
unsigned int key;
key = irq_lock();
_sys_clock_tick_count += ticks; _sys_clock_tick_count += ticks;
handle_expired_nano_timeouts(ticks); handle_expired_nano_timeouts(ticks);
handle_expired_nano_timers(ticks); handle_expired_nano_timers(ticks);
irq_unlock(key);
} }
/* get closest nano timers deadline expiry, (uint32_t)TICKS_UNLIMITED if none */ /* get closest nano timers deadline expiry, (uint32_t)TICKS_UNLIMITED if none */