lkml.org 
[lkml]   [2005]   [Jun]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 25 Jun 2005 13:29:02 +0200 (CEST)
FromOliver Neukum <>
SubjectRe: [RFC] Driver writer's guide to sleeping

On Sat, 25 Jun 2005, Denis Vlasenko wrote:

> schedule_timeout(timeout)
> 	Whee, it has a comment! :)
>  * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
>  * pass before the routine returns. The routine will return 0
>  *
>  * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
>  * delivered to the current task. In this case the remaining time
>  * in jiffies will be returned, or 0 if the timer expired in time
>  *
>  * The current task state is guaranteed to be TASK_RUNNING when this
>  * routine returns.
> 	Thus:
> 	set_current_state(TASK_[UN]INTERRUPTIBLE);
> 	schedule_timeout(timeout_in_jiffies)
> 
> msleep(ms)
> 	Sleeps at least ms msecs.
> 	Equivalent to:
> 	set_current_state(TASK_UNINTERRUPTIBLE);
> 	schedule_timeout(timeout)

If and only if you are not on any waitqueue. You may not be interrupted
by a signal, but you still can be woken with an explicit wake_up()

	HTH
		Oliver

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-25 13:19    [from the cache]
©2003-2008