I have a wait queue defined in a kernel module I am working on:
static DECLARE_WAIT_QUEUE_HEAD(WaitQ);
in the init_module() routine I create a new kernel thread which prints to the console every few seconds.
In my cleanup_module I set a variable which tells the thread to terminate and then have sleep_on(&WaitQ) as the last line in cleanup_module. Then in the thread routine wake_up(&WaitQ) is called when the variable set in cleanup_module is true, and then complete_and_exit to terminate the thread.
My question is. when sleep_on(&WaitQ) is called what is addded to the WaitQ. Is it the module as a whole or is it the thread started in the init_module?