Backward Compatibility
Task queues and timing issues have remained relatively constant over the years. Nonetheless, a few things have changed and must be kept in mind.
The functions sleep_on_timeout,
interruptible_sleep_on_timeout, and
schedule_timeout were all added for the 2.2
kernel. In the 2.0 days, timeouts were handled with a variable
(called timeout) in the task structure. As a
result, code that now makes a call like
interruptible_sleep_on_timeout(my_queue, timeout);
used to be implemented as
current->timeout = jiffies + timeout; interruptible_sleep_on(my_queue);
The sysdep.h header recreates
schedule_timeout for pre-2.4 kernels so that you
can use the new syntax and run on 2.0 and 2.2:
extern inline void schedule_timeout(int timeout)
{
current->timeout = jiffies + timeout;
current->state = TASK_INTERRUPTIBLE;
schedule();
current->timeout = 0;
}In 2.0, there were a couple of additional functions for putting functions into task queues. queue_task_irq could be called instead of queue_task in situations in which interrupts were disabled, yielding a (very) small performance benefit. queue_task_irq_off is even faster, but does not function properly in situations in which the task is already queued or is running, and can thus only be used where those conditions are guaranteed not to occur. Neither of these two functions provided much in the way of performance benefits, and they were removed in kernel 2.1.30. Using queue_task in all cases works with all kernel versions. ...