Re: Add msleep_interruptible() function to kernel/timer.c

From: Ingo Molnar
Date: Sun Aug 15 2004 - 21:24:44 EST



* maximilian attems <janitor@xxxxxxxxxxxxxx> wrote:

> +/**
> + * msleep_interruptible - sleep waiting for waitqueue interruptions
> + * @msecs: Time in milliseconds to sleep for
> + */
> +unsigned int msleep_interruptible(unsigned int msecs)
> +{
> + unsigned long timeout = msecs_to_jiffies(msecs);
> +
> + while (timeout && !signal_pending(current)) {
> + set_current_state(TASK_INTERRUPTIBLE);
> + timeout = schedule_timeout(timeout);
> + }
> + return jiffies_to_msecs(timeout);
> +}

looks good to me.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

Ingo

-
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/