Chapter 7. Wait Queues include/linux/wait.h

Table of Contents

Declaring
Queuing
Waking Up Queued Tasks

[SLEEPS]

A wait queue is used to wait for someone to wake you up when a certain condition is true. They must be used carefully to ensure there is no race condition. You declare a wait_queue_head_t, and then processes which want to wait for that condition declare a wait_queue_t referring to themselves, and place that in the queue.

Declaring

You declare a wait_queue_head_t using the DECLARE_WAIT_QUEUE_HEAD() macro, or using the init_waitqueue_head() routine in your initialization code.