Is there any way to "cancel" the:
std::this_thread::sleep_until(now + std::chrono::milliseconds(200));
Let's imagine the following scenario:
I set my thread to wake up in 200ms... but after 10ms, I receive a new request that my thread must wake up in 100ms...
So the thread should wake up in: 100ms and then at 200ms (after the current time, of course).
Thanks :)
I don't think you can do this with sleep_until. Have a look at condition variables ( http://www.cplusplus.com/reference/condition_variable/condition_variable/ ). Should be usable for exactly what you want.
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