On Wed, Jun 15, 2016 at 05:22:39PM -0400, Benjamin Walsh wrote:
The new APIs return generic negative errnos on failure and 0 on success,I did not get any feedback w.r.t. this: I have been using the int64_t in
instead of the RC_ ones used by the microkernel.
The timeout values passed to APIs are in seconds and nanoseconds,
similar to :code:`struct timespec`, instead of ticks, to allow for a
future fully tickless kernel. The granularity is in ticks for now
however since the system clock is still tick-based.
[Q: do we want a struct like timespec or use an int64_t in nanoseconds ?]
nanoseconds in the code I currently have, since it allows easily passing
a constant without creating a variable to hold a timespec. However, when
I started passing seemingly ridiculously huge numbers, I found that I
really had to double-check the values to make sure I had the correct
number of zeroes. :) (one second is 1000000000)
Also, it currently involves 64-bit math for converting to ticks and
back, since the kernel is still tick-based.
<taking out this thread from mothballs>
I won't take credit for this since it was not my idea. :)
Al had this interesting idea:
- use an int32_t with ms granularity. This gives a range of about 25
days (2^31 / 1000 / 3600 / 24) = 24.8 days.
- 0 is NO_WAIT.
- (-(2^31)) is FOREVER.
- Keep the other negative values for another (2^31) range of values that
are on a different scale if sub-ms granularity is needed and
supported. That gives ~2s of range if using us granularity.
i.e. -1 is 1us.