다음을 통해 공유


condition_variable::wait Method

Blocks a thread.

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

Parameters

  • Lck
    A unique_lock<mutex> object.

  • Pred
    Any expression that returns true or false.

Remarks

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

In effect, the second method executes the following code.

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

Requirements

Header: condition_variable

Namespace: std

See Also

Reference

condition_variable Class

<condition_variable>