Results 1 to 1 of 1
hi.
recent versions of linux module's work queue inteface has changed and i can't find any appropriate documentation for it. can *please* someone help me to make the basic skeletion ...
- 06-18-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 1
(kernel module) work queue interface
hi.
recent versions of linux module's work queue inteface has changed and i can't find any appropriate documentation for it. can *please* someone help me to make the basic skeletion of work queue module. here's what i have done by now.
thanks for your time
Code:#include <linux/kernel.h> #include <linux/module.h> #include <linux/workqueue.h> #include <linux/sched.h> #include <linux/init.h> #include <linux/interrupt.h> #define MY_WORK_QUEUE_NAME "THsched" //static void intrpt_routine(void *); void my_workqueue_handler(void *arg); static struct workqueue_struct *my_workqueue; static struct delayed_work *dwork; //static struct work_struct Task; static int die = 0; /* 1 for shutdown */ static int TimerIntrpt = 0; //static DECLARE_WORK(Task, my_workqueue_handler); void * my_workqueue_handler(void *arg) { TimerIntrpt++; if (die == 0) queue_delayed_work(my_workqueue, dwork, 100); } int __init init_module() { my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME); queue_delayed_work(my_workqueue, dwork, 100); printk(KERN_INFO "Module %s loaded.\n", MY_WORK_QUEUE_NAME); return 0; } void __exit cleanup_module() { die = 1; flush_workqueue(my_workqueue); cancel_delayed_work(dwork); destroy_workqueue(my_workqueue); printk(KERN_INFO "Module %s unloaded.\n", MY_WORK_QUEUE_NAME); return; }


Reply With Quote
