kernel: add defines for delta_ticks_from_prev special values

Use _INACTIVE instead of hardcoding -1.

_EXPIRED is defined as -2 and will be used for an improvement so that
interrupts are not locked for a non-deterministic amount of time while
handling expired timeouts.

_abort_timeout/_abort_thread_timeout return _INACTIVE instead of -1 if
the timeout has already been disabled.

Change-Id: If99226ff316a62c27b2a2e4e874388c3c44a8aeb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-12-06 11:44:01 -05:00 committed by Benjamin Walsh
commit d211a52fc0
5 changed files with 22 additions and 16 deletions

View file

@ -243,13 +243,19 @@ extern void k_thread_abort(k_tid_t thread);
* @cond INTERNAL_HIDDEN
*/
/* timeout has timed out and is not on _timeout_q anymore */
#define _EXPIRED (-2)
/* timeout is not in use */
#define _INACTIVE (-1)
#ifdef CONFIG_SYS_CLOCK_EXISTS
#define _THREAD_TIMEOUT_INIT(obj) \
(obj).nano_timeout = { \
.node = { {0}, {0} }, \
.thread = NULL, \
.wait_q = NULL, \
.delta_ticks_from_prev = -1, \
.delta_ticks_from_prev = _INACTIVE, \
},
#else
#define _THREAD_TIMEOUT_INIT(obj)
@ -695,7 +701,7 @@ struct k_timer {
#define K_TIMER_INITIALIZER(obj, expiry, stop) \
{ \
.timeout.delta_ticks_from_prev = -1, \
.timeout.delta_ticks_from_prev = _INACTIVE, \
.timeout.wait_q = NULL, \
.timeout.thread = NULL, \
.timeout.func = _timer_expiration_handler, \