mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
kthread, timer
This commit is contained in:
@@ -9,7 +9,7 @@ dmesg prints an integer every second until rmmod.
|
||||
Since insmod returns, this also illustrates how the work queues are asynchronous.
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/delay.h> /* usleep_range */
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h> /* atomic_t */
|
||||
@@ -32,10 +32,9 @@ static void work_func(struct work_struct *work)
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_WORK(work, work_func);
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
DECLARE_WORK(work, work_func);
|
||||
queue = create_workqueue("myworkqueue");
|
||||
queue_work(queue, &work);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user