| //===----------------------------------------------------------------------===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // UNSUPPORTED: libcpp-has-no-threads |
| // class condition_variable; |
| // template <class Predicate> |
| // void wait(unique_lock<mutex>& lock, Predicate pred); |
| #include <condition_variable> |
| std::condition_variable cv; |
| explicit Pred(int& i) : i_(i) {} |
| bool operator()() {return i_ != 0;} |
| std::unique_lock<std::mutex> lk(mut); |
| cv.wait(lk, Pred(test2)); |
| std::unique_lock<std::mutex>lk(mut); |