See also: How to use timers in Linux kernel device drivers?#include <linux/jiffies.h>#include <linux/kernel.h>#include <linux/module.h>#include <linux/timer.h>MODULE_LICENSE("GPL");static void callback(unsigned long data);static unsigned long onesec;DEFINE_TIMER(mytimer, callback, 0, 0);static void callback(unsigned long data){ pr_info("%u\n", (unsigned)jiffies); mod_timer(&mytimer, jiffies + onesec);}int init_module(void){ onesec = msecs_to_jiffies(1000); mod_timer(&mytimer, jiffies + onesec); return 0;}void cleanup_module(void){ del_timer(&mytimer);} 这篇关于如何立即取消Linux内核模块中工作队列的工作项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-02 03:01