time.monotonic() roll over

Marko Rauhamaa marko at pacujo.net
Fri Dec 5 13:48:54 EST 2014


Ian Kelly <ian.g.kelly at gmail.com>:

> On Thu, Dec 4, 2014 at 3:44 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> So, what's the semantics of time.sleep(), select.select() et al wrt
>> process or machine suspension?
>
> Rather than continue to speculate, I just tested this.

The test, of course, can only have one useful result...

> So it seems that it can go either way depending on the OS and perhaps the
> mechanism of suspension.

... and you got it.

If the semantics had coincided, the question would remain unresolved; it
could just have been a coincidence.

However, the variance in the results means the semantics are
unspecified.

I think programmer's would need facilities to determine and control the
suspension behavior.

All things being equal, *early* wakeup is preferable to late wakeup
because the application can then check for a spurious wakeup and go back
to sleep. The reverse situation would be painful to deal with.


Marko



More information about the Python-list mailing list