Linux: Wake_Up and Sleep_On Functions
I Am Trying to Learn How to Program Loadable Kernel Modules for Linux. I Was Wondering If Anyone Could Tell Me What the Functions Sleep_On and Wake_Up Do? in...
I am trying to learn how to program loadable kernel modules for linux. I was wondering if anyone could tell me what the functions sleep_on and wake_up do?
In examples I am looking at &WaitQ is always passed into them and
static DECLARE_WAIT_QUEUE_HEAD(WaitQ);
is declared at the top of the module.
1 Answer
If a task in the kernel arrives at a point where it wants to use resource and it gets told the resource is currently used by another task, it can decide to go sleep saying wake me up when the resource is available again. That's basically the deal with sleep_on and wake_up. See here for an explanation in detail: