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.
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 sayingwake 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: http://www.linuxtopia.org/online_books/Linux_Kernel_Module_Programming_Guide/x1032.html