Strange question here -- but:
If I use WaitForSingleObject on a mutex with a 20 minute timeout. Then, the machine enters sleep mode (or hibernate) while waiting.... Upon wake 12 hours later -- will my call to WaitForSingleObject time-out? or will the timer suspend with the machine sleep?
According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx, WaitForSingleObject does take time spent in low-power states into account, but only starting from Windows 8. So on Windows 7 it should behave as described above, but on Windows 8 and later the call will time out only when the system has been actively running for the requested amount of time.
Just tested on Windows 7 with 5 minutes timeout and 10 minutes sleep. I was waiting for endless thread.
Surprise - WaitForSingleObject
was timed out after my machine waked up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With