Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor editorial changes

...

The std::condition_variable::wait() function has an overload which overloaded that accepts a function object representing the predicate. This overload form of wait() behaves as if it were implemented as: while (!pred()) wait(lock);. This compliant solution uses a lambda as a predicate and passes it to the wait() function. Note that the The predicate is expected to return true when it is safe to proceed, which reverses the predicate logic from the compliant solution using an explicit loop predicate.

...