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:
parent
4863aa809c
commit
b4ece0ad44
6 changed files with 15 additions and 17 deletions
|
@ -873,9 +873,6 @@ __syscall void k_thread_start(k_tid_t thread);
|
|||
/* 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 @@ struct k_timer {
|
|||
|
||||
#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, \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue