Remix.run Logo
delusional 17 hours ago

> there is no guarantee your program will actually sleep for exactly the requested amount of time

This is technically true, but in the same way that under a preemptive operating system there's no guarantee that you'll ever be scheduled. The sleep is a minimum time you will sleep for, beyond that you already have no guarantee about when the next instruction executes.

dwattttt 16 hours ago | parent [-]

Spurious wakeups enters the chat.

quietbritishjim 14 hours ago | parent [-]

Any reasonable sleep API will handle spurious wake ups under the hood and not return control.

Joker_vD 14 hours ago | parent [-]

It will also ignore those pesky signals and restart the sleep :)

On a more serious note, any reasonable sleep API should either report all wake ups, no matter the reason, or none except for the timeout expiration itself. Any additional "reasonable" filtering is a loaded footgun because different API users have different ideas of what is "reasonable" for them.

13 hours ago | parent [-]
[deleted]