October 2017
Intermediate to advanced
586 pages
14h 8m
English
The following functions are defined in include/linux/workqueue.h:
struct workqueue_struct *myqueue; struct work_struct thework;
void dowork(void *data) { /* Code goes here */ };
myqueue = create_singlethread_workqueue( "mywork" ); INIT_WORK( &thework, dowork, <data-pointer> );
We could have also created our work queues through a macro called create_workqueue. The difference between create_workqueue and create_singlethread_workqueue is that the former will create a work queue that in turn will create a separate kernel thread on each and every processor available.
queue_work(myqueue, ...