The below table lists out the different workqueue APIs that are commonly used in the intialization and usage of a workqueue. For a comprehensive list – refer “workqueue.h” in the linux kernel.
| Workqueue API | Description |
| schedule_work | Schedule the work to be performed |
| schedule_delayed_work | Put work task in global workqueue after delay |
| create_workqueue | Creating a new work queue |
| alloc_workqueue | The newer API used to create a work queue. create_workqueue maps to this internally |
| queue_work | Queue work to workqueue |
| queue_delayed_work | Queue work to qorkqueue after dealy |
| flush_workqueue | Flush all the workqueue work |
| flush_scheduled_work | Ensure that any scheduled work has run to completion. |
| destroy_workqueue | To destroy the workqueue |
The Following MACROs are also used:
| Workqueue Macro | Description |
| DECLARE_WORK | Declare and Initialize Work |
| INIT_WORK | If we wish to initialize work separately from the declaraion |
| DECLARE_DELAYED_WORK | Declare and initialize delayed work |
In the following articles we will see example implementations for a workqueue.
Pingback: WorkQueues as bottom half methods in the Linux kernel | Hitch Hiker's Guide to Learning