Chinaunix首页 | 论坛 | 博客
  • 博客访问: 354717
  • 博文数量: 79
  • 博客积分: 1270
  • 博客等级: 中尉
  • 技术积分: 1370
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-12 08:48
个人简介

freedom~~~~~~~~~~

文章分类

全部博文(79)

文章存档

2014年(10)

2013年(2)

2012年(13)

2011年(54)

分类: LINUX

2011-08-04 15:30:00

  1. #include<linux/kernel.h>
  2. #include<linux/init.h>
  3. #include<linux/module.h>
  4. #include<linux/interrupt.h>

  5. static struct tasklet_struct my_tasklet;
  6. static void tasklet_handler(unsigned long data)
  7. {
  8.     printk("<0>this is tasklet working !!!!!!!!!!!!1%ld",data);
  9. }


  10. struct workqueue_struct* my_queue=NULL;
  11. static struct work_struct work;
  12. static void work_handler(struct work_struct *data)
  13. {
  14.     printk("<0>this is work working !!!!!!!!!!!\n");
  15. }

  16. static int work_init(void)
  17. {
  18.     tasklet_init(&my_tasklet,tasklet_handler,200);
  19.     tasklet_schedule(&my_tasklet);

  20.     my_queue=create_workqueue("queue");
  21.     INIT_WORK(&work,work_handler);
  22.     //schedule_delayed_work(&work,10);
  23.     queue_work(my_queue,&work);
  24.     
  25.     return 0;
  26. }

  27. static void work_exit(void)
  28. {
  29.     tasklet_kill(&my_tasklet);
  30.     destroy_workqueue(my_queue);
  31. }

  32. MODULE_LICENSE("GPL");
  33. MODULE_AUTHOR("ANYWIND");

  34. module_init(work_init);
  35. module_exit(work_exit);
阅读(892) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~