Workqueue APIs

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 APIDescription
schedule_workSchedule the work to be performed
schedule_delayed_workPut work task in global workqueue after delay
create_workqueueCreating a new work queue
queue_workQueue work to workqueue
queue_delayed_workQueue work to qorkqueue after dealy
flush_workqueueFlush all the workqueue work
flush_scheduled_workEnsure that any scheduled work has run to completion.
destroy_workqueueTo destroy the workqueue

The Following MACROs are also used:

Workqueue MacroDescription
DECLARE_WORKDeclare and Initialize Work
INIT_WORKIf we wish to initialize work separately from the declaraion
DECLARE_DELAYED_WORKDeclare and initialize delayed work

In the following articles we will see example implementations for a workqueue.

Workqueue code example using DECLARE_WORK Macro

Comments

  1. Pingback: WorkQueues as bottom half methods in the Linux kernel | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *