sam
sam

Reputation: 2579

cleanup_module linux kernel

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?

Upvotes: 0

Views: 2043

Answers (1)

gby
gby

Reputation: 15218

Neither - what is added to the queue is the thread (task) of the "rmmod" processor that caused the module removal.

Upvotes: 1

Related Questions