summaryrefslogtreecommitdiff
path: root/source/module/monitor_timer.c
diff options
context:
space:
mode:
authorJohn Doe <[email protected]>2023-12-11 07:48:30 +0000
committerJohn Doe <[email protected]>2023-12-11 07:48:30 +0000
commit894a10c48642d4f2948a7f5ef0ec3e8a8bfbb5ab (patch)
tree0267f61f6ec4963d74aa627deb60f9208c4e17af /source/module/monitor_timer.c
parent40b3cb2a6036f42028170378de216197cc1d8998 (diff)
try to fix workqueue bug
Diffstat (limited to 'source/module/monitor_timer.c')
-rw-r--r--source/module/monitor_timer.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/module/monitor_timer.c b/source/module/monitor_timer.c
index f23e330..705f97e 100644
--- a/source/module/monitor_timer.c
+++ b/source/module/monitor_timer.c
@@ -152,7 +152,7 @@ void start_all_hrTimer(void) {
printk(KERN_INFO "HrTimer start,module keep %d hrtimer for now\n", kernel_wtimer_num);
}
-/// @brief cancel hrTimer
+/// @brief cancel hrTimer and stop all work
/// @param
void cancel_all_hrTimer(void) {
int i = 0;
@@ -161,6 +161,25 @@ void cancel_all_hrTimer(void) {
timer = &(kernel_wtimer_list[i]);
TIMER_CANCEL(timer);
}
-
printk(KERN_INFO "HrTimer cancel,module keep %d hrtimer for now\n", kernel_wtimer_num);
+}
+
+
+void cancel_all_work(void) {
+ int i = 0;
+ kernel_watch_timer *timer = NULL;
+ for (i = 0; i < kernel_wtimer_num; i++) {
+ timer = &(kernel_wtimer_list[i]);
+ cancel_work_sync(&timer->wk);
+ }
+}
+
+void cancel_destory_all_work(void) {
+ int i = 0;
+ kernel_watch_timer *timer = NULL;
+ for (i = 0; i < kernel_wtimer_num; i++) {
+ timer = &(kernel_wtimer_list[i]);
+ cancel_work_sync(&timer->wk);
+ destroy_work_on_stack(&timer->wk);
+ }
} \ No newline at end of file