time.monotonic() roll over

Akira Li 4kir4.1i at gmail.com
Fri Dec 5 04:48:47 EST 2014


Dave Angel <davea at davea.name> writes:

...many words about sleep()...
> Since the OS has no way of knowing whether the thing being waited for
> is a thread, another process, a human being, a network operation, or
> the end of the world, the interpretation of sleep needs to be the most
> conservative one.  There are many ways of suspending a process, and
> some of them will also suspend the external event.  Since the OS
> cannot know which case is significant, it has to return control to the
> caller at the soonest of the many possible interpretations.

That is why there is API (e.g., clock_nanosleep()) that allows us to
choose whether we need a relative delay (e.g., kill a subprocess if it
hasn't finished in 10 seconds) or an absolute deadline (e.g., these
lights should be on 9pm-6am local time).

*Both* use cases are valid.


--
Akira




More information about the Python-list mailing list