Share via


condition_variable_any::wait Method

Blocks a thread.

template <class Lock>
   void wait(
      Lock& Lck
);
template<class Lock, class Predicate>
void wait(
   Lock& Lck,
   Predicate Pred
);

Parameters

  • Lck
    A mutex object of any type.

  • Pred
    Any expression that returns true or false.

Remarks

The first method blocks until the condition_variable_any object is signaled by a call to notify_one or notify_all. It can also wake up spuriously.

The second method in effect executes the following code.

while (!Pred())
    wait(Lck);

Requirements

Header: condition_variable

Namespace: std

See Also

Reference

condition_variable_any Class

<condition_variable>