public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: maximilian attems <janitor@sternwelten.at>
Cc: linux-kernel@vger.kernel.org, kj <kernel-janitors@osdl.org>
Subject: Re: Add msleep_interruptible() function to kernel/timer.c
Date: Sun, 15 Aug 2004 14:50:35 +0200	[thread overview]
Message-ID: <200408151450.35196.oliver@neukum.org> (raw)
In-Reply-To: <20040815121805.GA15111@stro.at>

Am Sonntag, 15. August 2004 14:18 schrieb maximilian attems:
> while doing kernel-janitor msleep conversion of drivers own (incorrect),
> functions, some places would need msleep_interruptible().
> 
> this function is equivalent to:
>         current->state = TASK_INTERRUPTIBLE;
> 	schedule_timeout(timeout);
> 
> idea from Ingo Molnar:
> well, aboves is not 100% equivalent because msleep() is uninterruptible so
> stoppage of the md thread (upon shutdown) will occur with only a 250 msec
> delay. Someone should add a msleep_interruptible() function to kernel/timer.c.

[..] 
> +/**
> + * msleep_interruptible - sleep waiting for waitqueue interruptions
> + * @msecs: Time in milliseconds to sleep for
> + */
> +void msleep_interruptible(unsigned int msecs)
> +{
> +	unsigned long timeout = msecs_to_jiffies(msecs);
> +
> +	while (timeout) {
> +		set_current_state(TASK_INTERRUPTIBLE);
> +		timeout = schedule_timeout(timeout);
> +	}

This is not really interruptible sleep because it is missing a check
for pending signals.

	Regards
		Oliver

      parent reply	other threads:[~2004-08-15 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 12:18 Add msleep_interruptible() function to kernel/timer.c maximilian attems
2004-08-15 11:54 ` Alan Cox
2004-08-15 13:25   ` maximilian attems
2004-08-16  2:22     ` Ingo Molnar
2004-08-16 20:00     ` [Kernel-janitors] " Nishanth Aravamudan
2004-08-15 12:50 ` Oliver Neukum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408151450.35196.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=janitor@sternwelten.at \
    --cc=kernel-janitors@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox