summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahooinc.com>2022-10-14 13:42:36 +0200
committerGitHub <noreply@github.com>2022-10-14 13:42:36 +0200
commit903bb98de0de610e155d9cc318b52ef89126489e (patch)
tree8dc8cf54f3dba13688db7b021694be683e940349 /vespalib
parentdf20f01fc37186681c017d377e381963dfdbcae2 (diff)
Add fallback variant when std::jthread is not available. (#24440)
* just use thread instead Co-authored-by: HÃ¥vard Pettersen <havardpe@yahooinc.com>
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/coro/lazy/lazy_test.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/vespalib/src/tests/coro/lazy/lazy_test.cpp b/vespalib/src/tests/coro/lazy/lazy_test.cpp
index 3141d7a5363..b838152249e 100644
--- a/vespalib/src/tests/coro/lazy/lazy_test.cpp
+++ b/vespalib/src/tests/coro/lazy/lazy_test.cpp
@@ -12,9 +12,12 @@ using vespalib::coro::Lazy;
using vespalib::coro::sync_wait;
std::mutex thread_lock;
-std::vector<std::jthread> threads;
+std::vector<std::thread> threads;
struct JoinThreads {
~JoinThreads() {
+ for (auto &thread: threads) {
+ thread.join();
+ }
threads.clear();
}
};
@@ -24,7 +27,7 @@ auto run_in_other_thread() {
bool await_ready() const noexcept { return false; }
void await_suspend(std::coroutine_handle<> handle) const {
auto guard = std::lock_guard(thread_lock);
- threads.push_back(std::jthread(handle));
+ threads.push_back(std::thread(handle));
}
void await_resume() const noexcept {}
};