aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-07-23 09:02:50 -0700
committerChris Robinson <[email protected]>2020-07-23 09:03:47 -0700
commit39a2f0626ad1755bdb2b00d3bab8204b05e3afc9 (patch)
tree128e2b965f8602cdc58e6c80d9080f5000088de1
parentac1fc1b60ac7dcdce61c875b2d547079eea30bcd (diff)
Use a predicate instead of a while loop
-rw-r--r--alc/backends/pulseaudio.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index f110af7d..6b8b4a6a 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -410,8 +410,8 @@ public:
{
if(op)
{
- while(pa_operation_get_state(op) == PA_OPERATION_RUNNING)
- mCondVar.wait(plock);
+ mCondVar.wait(plock,
+ [op]() -> bool { return pa_operation_get_state(op) != PA_OPERATION_RUNNING; });
pa_operation_unref(op);
}
}
@@ -507,7 +507,7 @@ pa_context *PulseMainloop::connectContext(std::unique_lock<std::mutex> &plock)
if(!mMainloop)
{
mThread = std::thread{std::mem_fn(&PulseMainloop::mainloop_proc), this};
- while(!mMainloop) mCondVar.wait(plock);
+ mCondVar.wait(plock, [this]() noexcept { return mMainloop; });
}
pa_context *context{pa_context_new(pa_mainloop_get_api(mMainloop), name)};