Re: Re: Re: how to sleep in kernel space ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nish :)

> Both of your code snippets are broken. You *must* set the state
> before calling schedule_timeout() to either TASK_INTERRUPTIBLE or
> TASK_UNINTERRUPTIBLE. If you don't, then you will have a busy loop.
> If you use INTERRUPTIBLE, signals will kill the sleep, in
> UNINTERRUPTIBLE, they will not.

Damn, I forgot that, thanks for reminding me about it, Nish. So, yes, 
use set_current_state(TASK_INTERRUPTIBLE)  or 
set_current_state(TASK_UNINTERRUPTIBLE) before you call 
schedule_timeout.

However, you still need a way to get out from that "while" loop, so 
checking for certain condition(s) are still necessary, unless you don't 
mind with rude "kill" :)

regards

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux