From 4b4462b83320d77e10ea347d4055656538a4b220 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 5 Mar 2024 14:58:44 +0800 Subject: [PATCH] 1 --- a8/xtimer.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/a8/xtimer.cc b/a8/xtimer.cc index b8fcff8..3fbc526 100644 --- a/a8/xtimer.cc +++ b/a8/xtimer.cc @@ -273,22 +273,36 @@ namespace a8 void ClearAttacher(Attacher* attacher) { + #if 1 + while (!list_empty(&attacher->timer_list_)) { + xtimer_list* tmp_timer = list_first_entry(&attacher->timer_list_, struct xtimer_list, attach_entry); + InternalDelete(tmp_timer, false, true); + } + #else struct list_head* pos = nullptr; struct list_head* n = nullptr; list_for_each_safe(pos, n, &attacher->timer_list_) { xtimer_list* tmp_timer = list_entry(pos, struct xtimer_list, attach_entry); InternalDelete(tmp_timer, false, true); } + #endif } void DestoryAttacher(Attacher* attacher) { + #if 1 + while (!list_empty(&attacher->timer_list_)) { + xtimer_list* tmp_timer = list_first_entry(&attacher->timer_list_, struct xtimer_list, attach_entry); + InternalDelete(tmp_timer, true, true); + } + #else struct list_head* pos = nullptr; struct list_head* n = nullptr; list_for_each_safe(pos, n, &attacher->timer_list_) { xtimer_list* tmp_timer = list_entry(pos, struct xtimer_list, attach_entry); InternalDelete(tmp_timer, true, true); } + #endif } void UpdateTimer()