User: Password:
Subscribe / Log in / New account

A pair of new timeout functions

The traditional way to delay a process for a given period of time is via schedule_timeout():


The state parameter to set_current_state() should be either TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE, depending on whether the delay should be cut short on signal delivery or not. Evidently, a common error is to omit the call to set_current_state(), with the result that the request delay does not happen. As a way of making life easier, the -mm tree now includes a pair of new functions:

    signed long schedule_timeout_interruptible(signed long timeout);
    signed long schedule_timeout_uninterruptible(signed long timeout);

These functions take care of setting the process state, so the delay should always happen as expected. Presumably these functions will be merged into the mainline for 2.6.14.

(Log in to post comments)

A pair of new timeout functions

Posted Sep 2, 2005 14:55 UTC (Fri) by forthy (guest, #1525) [Link]

Hm, again a relative delay. This is one of the primary design mistakes of
Unix: relative delays. You will always get possible race conditions with
relative delays if you want precission, but you can always easily convert
an absolute delay to a relative one (current_time+delay).

A pair of new timeout functions

Posted Sep 3, 2005 11:21 UTC (Sat) by renox (subscriber, #23785) [Link]

Both are useful IMHO, it's true that in some usage relative delay doesn't work, but most of the time they work very well, so having to use additionnal code to compute current_time+delay nearly everywhere is realy pointless.

Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds