Module: wine Branch: master Commit: 4e1b7cec167a836dbbe5780a1664e28afd3f9146 URL: https://gitlab.winehq.org/wine/wine/-/commit/4e1b7cec167a836dbbe5780a1664e28...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Sun Aug 28 09:51:25 2022 +1000
winepulse: Use the predicate to terminate the connect cond_wait loop.
---
dlls/winepulse.drv/pulse.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 463f4c28d00..a75184e712a 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -363,6 +363,8 @@ static BOOL pulse_stream_valid(struct pulse_stream *stream)
static HRESULT pulse_connect(const char *name) { + pa_context_state_t state; + if (pulse_ctx && PA_CONTEXT_IS_GOOD(pa_context_get_state(pulse_ctx))) return S_OK; if (pulse_ctx) @@ -381,15 +383,12 @@ static HRESULT pulse_connect(const char *name) goto fail;
/* Wait for connection */ - while (pulse_cond_wait()) { - pa_context_state_t state = pa_context_get_state(pulse_ctx); - - if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) - goto fail; + while ((state = pa_context_get_state(pulse_ctx)) != PA_CONTEXT_READY && + state != PA_CONTEXT_FAILED && state != PA_CONTEXT_TERMINATED) + pulse_cond_wait();
- if (state == PA_CONTEXT_READY) - break; - } + if (state != PA_CONTEXT_READY) + goto fail;
TRACE("Connected to server %s with protocol version: %i.\n", pa_context_get_server(pulse_ctx),