diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-09 20:52:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 20:52:18 +0200 |
commit | d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac (patch) | |
tree | 71dafa020afef119e3d3b57e22ca14f4ba42d9d8 /src/common | |
parent | Merge pull request #6164 from Morph1984/service-update-12.x (diff) | |
parent | video_core: Use a CV for blocking commands. (diff) | |
download | yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar.gz yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar.bz2 yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar.lz yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar.xz yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.tar.zst yuzu-d6e5e053a6c4fe8538d4b97b8f5a1eba61e2fcac.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/threadsafe_queue.h | 10 |
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(); } |