1

What happens to timed condition variable when the CPU is in a suspended state e.g. suspend to RAM? Does the timer continue or is it paused? Will the timeout condition be missed if the timeout has passed when the CPU wakes up? Or will the timer just resume when the CPU wakes up?

Ishmael
  • 11
  • 2
  • why don't you give a shot? make it sleep for 1 minute and hibernate your laptop in the middle of it for 1 minute – DAG Oct 11 '16 at 04:32
  • With the boost timed condition wait the timer seems to be paused when the CPU is in standby mode. I noticed the timeout is extended by the time the CPU is in standby mode. I haven't checked this for std::condition_variable::wait_for though. I couldn't find any reference online. I wished somebody can point out to one or give a detailed explanation. – Ishmael Oct 12 '16 at 09:06

1 Answers1

0

The requirement is that the wait will wait for at least as long as was requested. If the OS does something that makes the wait take longer than was requested, then that's what happens: it waits longer. If you need exact (or nearly exact) delays, then you need a Real-Time Operating System (RTOS).

Pete Becker
  • 74,985
  • 8
  • 76
  • 165