kernel: timeout: remove local fix for double-remove
Use the new generic capability to detect unlinked sys_dnode_t instances. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
d40b8ce1fb
commit
25fbe7b60d
2 changed files with 6 additions and 8 deletions
|
@ -22,6 +22,7 @@ extern "C" {
|
|||
|
||||
static inline void _init_timeout(struct _timeout *t, _timeout_func_t fn)
|
||||
{
|
||||
sys_dnode_init(&t->node);
|
||||
t->dticks = _INACTIVE;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,14 +46,11 @@ static struct _timeout *next(struct _timeout *t)
|
|||
|
||||
static void remove_timeout(struct _timeout *t)
|
||||
{
|
||||
if (t->node.next != NULL && t->node.prev != NULL) {
|
||||
if (next(t) != NULL) {
|
||||
next(t)->dticks += t->dticks;
|
||||
}
|
||||
|
||||
sys_dlist_remove(&t->node);
|
||||
if (next(t) != NULL) {
|
||||
next(t)->dticks += t->dticks;
|
||||
}
|
||||
t->node.next = t->node.prev = NULL;
|
||||
|
||||
sys_dlist_remove(&t->node);
|
||||
t->dticks = _INACTIVE;
|
||||
}
|
||||
|
||||
|
@ -113,7 +110,7 @@ int _abort_timeout(struct _timeout *to)
|
|||
int ret = _INACTIVE;
|
||||
|
||||
LOCKED(&timeout_lock) {
|
||||
if (to->dticks != _INACTIVE) {
|
||||
if (sys_dnode_is_linked(&to->node)) {
|
||||
remove_timeout(to);
|
||||
ret = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue