From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Linux kernel <linux-kernel@vger.kernel.org>
Subject: timing code in 2.6.1
Date: Fri, 16 Jan 2004 11:51:52 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.53.0401161150390.28039@chaos> (raw)
Some drivers are being re-written for 2.6++. The following
construct seems to work for "waiting for an event" in
the kernel modules.
// No locks are being held
tim = jiffies + EVENT_TIMEOUT;
while(!event() && time_before(jiffies, tim))
schedule_timeout(0);
Is there anything wrong?
Do I have to execute "set_current_state(TASK_INTERRUPTIBLE)" before?
Do I have to execute "set_current_state(TASK_RUNNING)" after?
I don't want to have to change this again so I really need to
know. For instance, if I execute "set_current_state(TASK_INTERRUPTIBLE)"
in version 2.4.24, it didn't hurt anything. In 2.6.1, there are
conditions where schedule_timeout(0) doesn't return if another
task is spinning "while(1) ; ". This is NotGood(tm).
Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.
next reply other threads:[~2004-01-16 16:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 16:51 Richard B. Johnson [this message]
2004-01-16 23:31 ` Andrew Morton
2004-01-19 14:11 ` Richard B. Johnson
2004-01-20 9:59 ` George Anzinger
2004-01-22 2:26 ` Jamie Lokier
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=Pine.LNX.4.53.0401161150390.28039@chaos \
--to=root@chaos.analogic.com \
--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
all inboxes | Powered by JetHome®