遇到timer死锁系统
#include <linux/init.h>#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
void timer_fun(unsigned long data)
{
}
static int __init hello_init(void)
{
struct timer_list timer;
init_timer(&timer);
timer.data=0;
timer.expires=jiffies+1*HZ;
timer.function=timer_fun;
add_timer(&timer);
printk("timer is running now !!\n");
return 0;
}
static void __exit hello_exit(void)
{
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("crazycode");
我不知道上面的代码有什么问题,但是一加载系统就死锁了,各位帮忙看看,谢谢。 在ioctl里面就没有问题了,估计是模块加载的时候不允许做些异步的事情,原理还有待高手指教 确认是加载,而不是卸载的时候有问题?我印象中MODULE_INIT里面可以加TIMER的。可以看看LDD3, JIT.C 例子代码。 回复 3# accessory
加载的问题,可能timer是局部变量的问题吧
页:
[1]