2

The boost documentation says:

Returns: false if the call is returning because the time specified by abs_time was reached, true otherwise.

But what is returned if there is a spurious wakeup?

Torleif
  • 2,334
  • 3
  • 27
  • 28
  • Sounds like "otherwise" to me. – Steve Jessop Jan 12 '11 at 14:48
  • Yes :-) It is just that it seems to return false for me. I was wondering if anybody has actually observed what happens. – Torleif Jan 12 '11 at 14:51
  • 1
    The wording in the documentation I think is wrong, "natural instinct" tells you that it MUST return false, otherwise the function would yield a false positive (i.e. you'd might think that the condition really had been set). – Robert Jul 02 '12 at 14:56

1 Answers1

5

If the condition variable could figure that it is a spurious wake-up there would be no need to return, would it?

You need to check if the data protected by the mutex and the condition variable has changed to detect a spurious wake-up. The condition variable can not do that for you.

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271