lkml.org 
[lkml]   [1999]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Offtopic: Newbie: Polling delay and how to do it?
On Tue, 12 Jan 1999, Simon wrote:

> In the 2.0.x kernels, there is a timeout field in struct task_struct,
> which can be used to implement a polling delay. In the later 2.1.x kernels
> this field has been removed. I was wondering how a polling delay is now
> implemented in the 2.1.x kernels without this field, which seems to be
> missing now.

Yep. This is to avoid the jiffy wrap problem.

> Should I make use of a task_queue, or a loop where I calculate the number
> of jiffies until the next poll and do something along the lines of:
> while (jiffies < jiffies_at_next_poll)
> schedule();

That's the traditional way, and it breaks after ~670 days (not often a
problem if your power supply is anything like ours :)

Late 2.1 (and the 2.2pre kernels) have a new function schedule_timeout()
which deals with this requirement.

If you need more complicated things, then there are time_before(),
time_after(), time_before_eq() and time_after_eq() macros which are
jiffy-wrap-safe.

> I realise that this might be totally off topic, but I have no idea where
> else to make a start. Feel free to point me in the right direction if
> this is an inappropriate post (in which case, I'll apologise in advance)

Nope, you're on the right track with the linux-kernel list.

Matthew.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.051 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site