RE: FW: [RFC] A more general timeout specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From: Christopher Friesen [mailto:[email protected]]
>Joe Korty wrote:
>
>> The returned timeout struct has a bit used to mark the value as
absolute.  Thus
>> the caller treats the returned timeout as a opaque cookie that can be
>> reapplied to the next (or more likely, the to-be restarted) timeout.
>
>Okay, endtime is always absolute value of when it should have expired.
>But I think I see a problem with the opaque cookie scheme and repeating
>timeouts.
>
>Suppose I want to wake my application at INTERVAL nanoseconds from now
>on the MONOTONIC clock, then again every INTERVAL nanoseconds after
that.

This API is not intended for your application to use directly, but
for kernel APIs that take sleeps from userspace (like
pthread_mutex_lock()
and friends), so this scenario is not very likely.

Granted, sleep() can be implemented with it too, so...

>How do I do that with this API?
>
>I can get the first sleep.  Suppose I oversleep by X nanoseconds.  I
>wake, and get an opaque timeout back.  How do I ask for the new wake
>time to be "endtime + INTERVAL"?

endtime.ts += INTERVAL

[we all know opaque is relative too] 
Or better, use itimers :)

-- Inaky
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux