summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2021-04-06 20:30:22 +0200
committerMarkus Wick <markus@selfnet.de>2021-04-07 22:38:52 +0200
commit4aec060f6de410698d5b0a5bffd42d4327b258e4 (patch)
tree224799482cc260b15af31274497d92c308393113 /src/common
parentMerge pull request #6130 from degasus/better_assert_handling (diff)
downloadyuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar.gz
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar.bz2
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar.lz
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar.xz
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.tar.zst
yuzu-4aec060f6de410698d5b0a5bffd42d4327b258e4.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/threadsafe_queue.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index a4647314a..ad04df8ca 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -83,11 +83,15 @@ public:
return true;
}
- T PopWait() {
+ void Wait() {
if (Empty()) {
std::unique_lock lock{cv_mutex};
cv.wait(lock, [this]() { return !Empty(); });
}
+ }
+
+ T PopWait() {
+ Wait();
T t;
Pop(t);
return t;
@@ -156,6 +160,10 @@ public:
return spsc_queue.Pop(t);
}
+ void Wait() {
+ spsc_queue.Wait();
+ }
+
T PopWait() {
return spsc_queue.PopWait();
}