diff options
Diffstat (limited to 'alc/backends/pulseaudio.cpp')
-rw-r--r-- | alc/backends/pulseaudio.cpp | 6 |
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)}; |