May 2019
Intermediate to advanced
356 pages
9h 6m
English
The preceding example in the recipe can be simplified by using the shared work queue. This is a special work queue defined by the kernel itself that can be used by device drivers (and other kernel entities) if they promise not to monopolize the queue for long periods of time (that is no long periods of sleep and no long-running tasks), if they accept the fact that their handlers may take longer to get their fair share of CPU. If both conditions are met, we can avoid creating a custom work queue with create_singlethread_workqueue() and we can schedule work by simply using schedule_work() and schedule_delayed_work() as follows. Here are the handlers:
--- a/drivers/misc/irqtest.c+++ b/drivers/misc/irqtest.c...+static void ...
Read now
Unlock full access