[lkml]   [2002]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: schedule_timeout()
Lahti Oy wrote:
> Why does schedule_timeout() take a signed long as an argument and then check
> for possible negative values? Wouldn't it be better to just take an unsigned
> long as argument, thus eliminating all dumb checks in the code?

Because someone may do:

schedule_timeout(when_i_want_to_wake - jiffies);

and if the current time happens to be _after_ when_i_want_to_wake,
we want schedule_timeout to cope with that and do the right thing.

> Another issue I found concerns setting current task state to TASK_RUNNING
> after calling schedule_timeout(). This seems to be done in many parts of the
> kernel, though Kernel-API documentations found from seem
> to claim that task state is guaranteed to be TASK_RUNNING after
> schedule_timeout() returns. Is the documentation faulty or does the kernel
> have obsoleted code?

The documentation is correct.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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