1
0
mirror of https://github.com/bashrc/LKMPG.git synced 2018-06-11 03:06:54 +02:00
Files
LKMPG/4.12.12/examples/sched.c
2018-01-03 16:29:18 +00:00

31 lines
565 B
C

#include <linux/module.h>
#include <linux/init.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_AUTHOR("Bob Mottram");
MODULE_DESCRIPTION("Workqueue example");