在这篇文章之后,我在我的内核模块中实现了:
static int val = 1;
static char thread_name[128] = "my thread name";
在初始化中:
thread1 = kthread_run(thread_fn, &val, thread_name);
这就是功能
int thread_fn(void *data)
{
unsigned long j0,j1;
int delay = 60*HZ;
j0 = jiffies;
j1 = j0 + delay;
printk(KERN_INFO "here");
while (time_before(jiffies, j1))
schedule();
return 1;
}
为什么这只执行1次?