[libcxx-commits] [libcxx] [libc++][test] Fix race condition in condition_variable_any tests (PR #84788)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 11 09:29:37 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Hui (huixie90)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/84788.diff
3 Files Affected:
- (modified) libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp (+1-1)
- (modified) libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp (+1-1)
- (modified) libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp (+1-1)
``````````diff
diff --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp
index 4ea60557d9f88c..7a39d1253a33cf 100644
--- a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp
+++ b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_token_pred.pass.cpp
@@ -119,7 +119,7 @@ void test() {
bool flag = false;
auto thread = support::make_test_thread([&]() {
std::this_thread::sleep_for(2ms);
- Lock lock2{mutex};
+ std::unique_lock<Mutex> lock2{mutex};
flag = true;
cv.notify_all();
});
diff --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp
index e96a3e8bd1bc0b..f322d8cfdc68fc 100644
--- a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp
+++ b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_token_pred.pass.cpp
@@ -63,7 +63,7 @@ void test() {
bool flag = false;
auto thread = support::make_test_thread([&]() {
std::this_thread::sleep_for(std::chrono::milliseconds(2));
- Lock lock2{mutex};
+ std::unique_lock<Mutex> lock2{mutex};
flag = true;
cv.notify_all();
});
diff --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp
index d649db025d755d..e7388b9ce0e176 100644
--- a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp
+++ b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_until_token_pred.pass.cpp
@@ -119,7 +119,7 @@ void test() {
bool flag = false;
auto thread = support::make_test_thread([&]() {
std::this_thread::sleep_for(std::chrono::milliseconds(2));
- Lock lock2{mutex};
+ std::unique_lock<Mutex> lock2{mutex};
flag = true;
cv.notify_all();
});
``````````
</details>
https://github.com/llvm/llvm-project/pull/84788
More information about the libcxx-commits
mailing list