1
0

sched.c 564 B

1234567891011121314151617181920212223242526272829
  1. #include <linux/module.h>
  2. #include <linux/init.h>
  3. #include <linux/workqueue.h>
  4. static struct workqueue_struct *queue=NULL;
  5. static struct work_struct work;
  6. static void work_handler(struct work_struct *data)
  7. {
  8. pr_info ("work handler function.\n");
  9. }
  10. int init_module()
  11. {
  12. queue = alloc_workqueue("HELLOWORLD", WQ_UNBOUND, 1);
  13. INIT_WORK(&work, work_handler);
  14. schedule_work(&work);
  15. return 0;
  16. }
  17. void cleanup_module()
  18. {
  19. destroy_workqueue(queue);
  20. }
  21. MODULE_LICENSE("GPL");
  22. MODULE_AUTHOR("Bob Mottram");
  23. MODULE_DESCRIPTION("Workqueue example");