From: dmitrykos Date: Fri, 26 Aug 2016 19:31:45 +0000 (+0300) Subject: wasapi: replaced InterlockedCompareExchange with InterlockedOr and added clarifying... X-Git-Tag: pa_stable_v190600_20161030~15^2 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=319b19203aca10c0f241faf2ff89ec300c3aba4c;p=portaudio wasapi: replaced InterlockedCompareExchange with InterlockedOr and added clarifying comment why Interlocked API is used --- diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index be3115a..e865c7b 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -1367,7 +1367,8 @@ static HRESULT ActivateAudioInterface_WINRT(const PaWasapiDeviceInfo *deviceInfo IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error); // Wait in busy loop for async operation to complete - while (SUCCEEDED(hr) && !InterlockedCompareExchange(&handlerImpl->done, FALSE, FALSE)) + // Use Interlocked API here to ensure that ->done variable is read every time through the loop + while (SUCCEEDED(hr) && !InterlockedOr(&handlerImpl->done, 0)) { Sleep(1); }