作者enduser (淡水..)
看板LinuxDev
标题[问题] 关於 schedule_timeout 的用法
时间Tue Mar 2 19:05:28 2010
请教一下大家,我想在五秒之後 printk 一段讯息,
但是听说用 busy wait 方式不好,所以可以用 schedule_timeout
我写一段 hello.c 如下,希望在 insmod hello.ko 後五秒能在 dmesg 看到讯息
这是写在 module_init 的 function 里面的片段
schedule_timeout (5*HZ);
printk(KERN_ALERT "Hello, world after 5 secs\n");
不过却发现 insmod hello.ko 後就马上印出来了,而不是五秒之後
请问一下要怎改才对呢?
谢谢 :-)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.136.110.203
1F:→ mecs:试试 schedule_timeout_interruptible 03/03 10:56
2F:→ enduser:谢罗 schedule_timeout_interruptible 可以 03/05 14:48