Skip to content

Commit 1b73a47

Browse files
committed
[libc++][test] Fix race condition in condition_variable_any tests
1 parent 7dc4d5f commit 1b73a47

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void test() {
119119
bool flag = false;
120120
auto thread = support::make_test_thread([&]() {
121121
std::this_thread::sleep_for(2ms);
122-
Lock lock2{mutex};
122+
std::unique_lock<Mutex> lock2{mutex};
123123
flag = true;
124124
cv.notify_all();
125125
});

libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void test() {
6363
bool flag = false;
6464
auto thread = support::make_test_thread([&]() {
6565
std::this_thread::sleep_for(std::chrono::milliseconds(2));
66-
Lock lock2{mutex};
66+
std::unique_lock<Mutex> lock2{mutex};
6767
flag = true;
6868
cv.notify_all();
6969
});

libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void test() {
119119
bool flag = false;
120120
auto thread = support::make_test_thread([&]() {
121121
std::this_thread::sleep_for(std::chrono::milliseconds(2));
122-
Lock lock2{mutex};
122+
std::unique_lock<Mutex> lock2{mutex};
123123
flag = true;
124124
cv.notify_all();
125125
});

0 commit comments

Comments
 (0)