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>
diff --git a/include/kernel.h b/include/kernel.h
index fa18338..2edd113 100644
--- a/include/kernel.h
+++ b/include/kernel.h
@@ -873,9 +873,6 @@
/* timeout has timed out and is not on _timeout_q anymore */
#define _EXPIRED (-2)
-/* timeout is not in use */
-#define _INACTIVE (-1)
-
struct _static_thread_data {
struct k_thread *init_thread;
k_thread_stack_t *init_stack;
@@ -1334,7 +1331,7 @@
#define _K_TIMER_INITIALIZER(obj, expiry, stop) \
{ \
- .timeout.dticks = _INACTIVE, \
+ .timeout.dticks = 0, \
.timeout.fn = _timer_expiration_handler, \
.wait_q = _WAIT_Q_INIT(&obj.wait_q), \
.expiry_fn = expiry, \