public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: maximilian attems <janitor@sternwelten.at>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	kj <kernel-janitors@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Kernel-janitors] Re: Add msleep_interruptible() function to kernel/timer.c
Date: Mon, 16 Aug 2004 13:00:37 -0700	[thread overview]
Message-ID: <20040816200037.GC1942@us.ibm.com> (raw)
In-Reply-To: <20040815132548.GF1799@stro.at>

On Sun, Aug 15, 2004 at 03:25:48PM +0200, maximilian attems wrote:
> On Sun, 15 Aug 2004, Alan Cox wrote:
> 
> > On Sul, 2004-08-15 at 13:18, maximilian attems wrote:
> > > + * 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) {
> > 
> > You want to have while(timeout && !signal_pending(current))
> > 
> > A signal will wake the timeout which will then loop. It might also
> > be good to add
> > 
> > > +		set_current_state(TASK_INTERRUPTIBLE);
> > > +		timeout = schedule_timeout(timeout);
> > > +	}
> > 
> > return timeout;
> > 
> > so that the caller knows more about how long the timer ran for before
> > the interrupt and if it was interrupted.
> 
> belows patches returns timeout in msecs 
> as the function is also called with that unit, 
> added definition in include/linux/delay.h

<snip>

An entry could be added to the TODO to do what I had done but with
long delays in TASK_INTERRUPTIBLE (which there probably should not be
many of). It would also probably be useful to verify that any drivers 
sleeping for times measurable in msecs while INTERRUPTIBLE actually intend
to do so (as I tried to do in some cases).

-Nish

  parent reply	other threads:[~2004-08-16 20:00 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     ` Nishanth Aravamudan [this message]
2004-08-15 12:50 ` Oliver Neukum

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=20040816200037.GC1942@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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