From: Denis Vlasenko <vda@ilport.com.ua>
To: Oliver Neukum <neukum@fachschaft.cup.uni-muenchen.de>,
Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net
Subject: Re: [RFC] Driver writer's guide to sleeping
Date: Sat, 25 Jun 2005 14:54:36 +0300 [thread overview]
Message-ID: <200506251454.36745.vda@ilport.com.ua> (raw)
In-Reply-To: <Pine.LNX.4.58.0506251327390.3206@fachschaft.cup.uni-muenchen.de>
On Saturday 25 June 2005 14:29, Oliver Neukum wrote:
> On Sat, 25 Jun 2005, Denis Vlasenko wrote:
>
> > schedule_timeout(timeout)
> > Whee, it has a comment! :)
> > * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
> > * pass before the routine returns. The routine will return 0
[snip]
> > Thus:
> > set_current_state(TASK_[UN]INTERRUPTIBLE);
> > schedule_timeout(timeout_in_jiffies)
> >
> > msleep(ms)
> > Sleeps at least ms msecs.
> > Equivalent to:
> > set_current_state(TASK_UNINTERRUPTIBLE);
> > schedule_timeout(timeout)
>
> If and only if you are not on any waitqueue. You may not be interrupted
> by a signal, but you still can be woken with an explicit wake_up()
Like this?
--
vda
--- linux-2.6.12.src/kernel/timer.c.orig Sun Jun 19 16:11:00 2005
+++ linux-2.6.12.src/kernel/timer.c Sat Jun 25 14:50:22 2005
@@ -1059,12 +1059,16 @@ static void process_timeout(unsigned lon
*
* You can set the task state as follows -
*
- * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
- * pass before the routine returns. The routine will return 0
+ * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies will pass
+ * before the routine returns, unless something explicitly
+ * wakes you up with wake_up_process(). Signals won't interrupt
+ * such sleep.
*
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
- * delivered to the current task. In this case the remaining time
- * in jiffies will be returned, or 0 if the timer expired in time
+ * delivered to the current task.
+ *
+ * The remaining time in jiffies will be returned, or 0 if the timer
+ * expired in time.
*
* The current task state is guaranteed to be TASK_RUNNING when this
* routine returns.
next prev parent reply other threads:[~2005-06-25 11:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-25 9:50 [RFC] Driver writer's guide to sleeping Denis Vlasenko
2005-06-25 11:29 ` Oliver Neukum
2005-06-25 11:54 ` Denis Vlasenko [this message]
2005-06-26 19:38 ` Oliver Neukum
2005-06-27 13:20 ` Denis Vlasenko
2005-06-27 14:56 ` Domen Puncer
2005-06-27 16:04 ` Nish Aravamudan
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=200506251454.36745.vda@ilport.com.ua \
--to=vda@ilport.com.ua \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=neukum@fachschaft.cup.uni-muenchen.de \
/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