lkml.org 
[lkml]   [2005]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Driver writer's guide to sleeping
On 6/25/05, Denis Vlasenko <vda@ilport.com.ua> wrote:
> Hi folks,
>
> I'm working on a Linux wireless driver.
>
> I compiled a little guide for myself about waiting primitives.
> I would appreciate if you look thru it. Maybe I'm wrong somewhere.

<snip>
> schedule_timeout(timeout)
<snip>
> msleep(ms)
<snip>
> msleep_interruptible(ms)
<snip>

So, there are four cases in the schedule_timeout() family of sleeps,
based one what you would like to be woken up on:

Signals and Waitqueue events:
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(some_time_in_jiffies);

Signals only:
msleep_interruptible(some_time_in_msecs);

Waitqueue events only:
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(some_time_in_jiffies);

Neither signals nor waitqueues:
msleep(some_time_in_msecs);

Hopefully that clears some things up.

w.r.t to wait-queue event sleeping, you probably should also be aware
of the wait_event() family of macros.

Thanks,
Nish
-
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-27 18:25    [W:0.054 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site