Messages in this thread | | | Date | Tue, 12 Jan 1999 17:17:05 +0000 (GMT) | From | Matthew Kirkwood <> | Subject | Re: 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/
| |