New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not wake up computer from sleep #67
Conversation
Thanks for the patch. I'm not a Windows expert. We will merge it as soon as Niall has time to check it. |
This is not a documented valid value for the WakeContext parameter. I would be happy to sign off on this anyway, however neither Wine nor ReactOS fully implement SetWaitableTimerEx() so I cannot tell what the valid values are from them either. The NT kernel docs are similarly not helpful: https://msdn.microsoft.com/en-us/library/windows/hardware/ff553249(v=vs.85).aspx. Vicente you could try merging this patch and see what happens? As I mentioned, I never saw a problem on my machine with the current code anyway, so it is hard for me to say if this patch is good or bad. |
We're successfully using principally the same patch. But the nullptr should probably be changed to 0 or NULL in order to support old compilers? |
we looked at the disassembled source for SetWaitableTimerEx, as it turns out, setting wakecontext to null actually calls SetWaitableTimer :D |
@MarcelRaad should I switch to NULL instead? the rest of the file used NULL so I switched and force-pushed |
Supplying a REASON_CONTEXT to SetWaitableTimerEx() will wakeup the computer from sleep. Supplying a nullptr instead disables wake. Fixes: https://svn.boost.org/trac/boost/ticket/11368
f5dce6e
to
64dd10a
Compare
This would suggest that we revert my patch to its previous edition. It might be worth asking on stackoverflow how to correctly call SetWaitableTimerEx. Niall |
I'm thinking that one could pass a NULL WakeContext when wait time exceeds some amount? That would disable PC wake, but keep timer coalescing for shorter values. What's a reasonable amount? Ten seconds? |
@ned14: I was thinking about that as well. But on the other hand are coalescing timers really useful without wake? |
I'll just leave this here. |
I can not take this PR as it is for master. I'll propagate this PR to develop and see how it behaves. Niall, please, come back to this issue once you have more time. |
Patch applied to develop branch |
@ned14: do you want me to try and revert the following commit or should I just prepare a commit which removes the parts about SetWaitableTimerEx and switch back to SetWaitableTimer? Personally I am unsure if coalescing timers are useful without wakeup (no need to coalesce if already running the CPU at full speed).
|
Hi Mauve, I will be very grateful if you go ahead and provide a PR to revert this commit. Vicente |
Stackoverflow says the current patch is the right one https://stackoverflow.com/questions/32749829/how-to-call-setwaitabletimerex-correctly |
@ned14: Perfect thanks, I will prepare a patch to cleanup the remaining unused wakecontext code. |
Supplying a REASON_CONTEXT to SetWaitableTimerEx() will wakeup
the computer from sleep. Supplying a nullptr instead disables wake.
Fixes: https://svn.boost.org/trac/boost/ticket/11368