kernel: timeout: detect inactive timeouts using dnode linked state

Whether a timeout is linked into the timeout queue can be determined
from the corresponding sys_dnode_t linked state.  This removes the need
to use a special flag value in dticks to determine that the timeout is
inactive.

Update _abort_timeout to return an error code, rather than the flag
value, when the timeout to be aborted was not active.

Remove the _INACTIVE flag value, and replace its external uses with an
internal API function that checks whether a timeout is inactive.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-01-02 08:29:43 -06:00 committed by Carles Cufí
commit b4ece0ad44
6 changed files with 15 additions and 17 deletions

View file

@ -8,6 +8,7 @@
#define ZEPHYR_KERNEL_INCLUDE_KSCHED_H_
#include <kernel_structs.h>
#include <timeout_q.h>
#include <tracing.h>
#include <stdbool.h>
@ -83,11 +84,7 @@ static inline int _is_thread_prevented_from_running(struct k_thread *thread)
static inline bool _is_thread_timeout_active(struct k_thread *thread)
{
#ifdef CONFIG_SYS_CLOCK_EXISTS
return thread->base.timeout.dticks != _INACTIVE;
#else
return false;
#endif
return !_is_inactive_timeout(&thread->base.timeout);
}
static inline bool _is_thread_ready(struct k_thread *thread)