Re: [RFC] Driver writer's guide to sleeping

From: Nish Aravamudan
Date: Mon Jun 27 2005 - 11:22:23 EST


On 6/25/05, Denis Vlasenko <vda@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/