カーネル モジュールの奇妙な動作に気付きました。次のコードを実行すると (waitqueues を使用)。finish_wait() の後、printk() がカーネル ログに表示されません。また、5行目は一度しか印刷されません。何が起こっているのですか?
DEFINE_WAIT(wait);
DECLARE_WAIT_QUEUE_HEAD(wait_q);
flags |= O_NONBLOCK;
while (( err = kthread->sock->ops->accept(kthread->sock, kthread->sock_send, flags) ) < 0){
printk("%s: before prepare_to_wait err = -%d\n", __func__,err);
prepare_to_wait(&wait_q, &wait, TASK_INTERRUPTIBLE);
if(kthread_should_stop()){
printk("%s: killing thread\n", __func__);
msleep(1000);
finish_wait(&wait_q, &wait);
goto close_and_out;
}
schedule();
}
finish_wait(&wait_q, &wait);
printk("after finish wait: This doesn't show up in kernel logs...\n");