public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* timing code in 2.6.1
@ 2004-01-16 16:51 Richard B. Johnson
  2004-01-16 23:31 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Richard B. Johnson @ 2004-01-16 16:51 UTC (permalink / raw)
  To: Linux kernel


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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-22  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-16 16:51 timing code in 2.6.1 Richard B. Johnson
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox