Info

#define DEFINE_WAIT(name) \

.func = autoremove_wake_function, \

.task_list = LIST_HEAD_INIT((name).task_list), \

autoremove_wake_function is now used to wake the process. The function not only calls default_wake_function, but also removes the wait queue element from the wait queue.

add_wait_queue is normally not used directly. It is more common to use wait_event. This is a macro that requires two parameters:

1. A wait queue to wait on.

2. A condition in the form of a C expression of the event to wait for.

All the macro needs to do is to ensure that the condition is not yet already fulfilled; in this case, processing can be immediately stopped because there is nothing to wait for. The hard work is delegated to _wait_event:

Continue reading here: Info

Was this article helpful?

0 0