lkmpg/examples/sched.c
Jim Huang faf3aa7c22 Make each source file more consistent
It is vital to denote the file name and summary for each source,
otherwise readers could not figure out the corresponding files.
2021-07-22 11:25:32 +08:00

32 lines
554 B
C

/*
* sched.c
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/workqueue.h>
static struct workqueue_struct *queue = NULL;
static struct work_struct work;
static void work_handler(struct work_struct *data)
{
pr_info("work handler function.\n");
}
int init_module()
{
queue = alloc_workqueue("HELLOWORLD", WQ_UNBOUND, 1);
INIT_WORK(&work, work_handler);
schedule_work(&work);
return 0;
}
void cleanup_module()
{
destroy_workqueue(queue);
}
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Workqueue example");