wasapi: replaced InterlockedCompareExchange with InterlockedOr and added clarifying comment why Interlocked API is used
This commit is contained in:
parent
dae0d7f8e7
commit
319b19203a
1 changed files with 2 additions and 1 deletions
|
|
@ -1367,7 +1367,8 @@ static HRESULT ActivateAudioInterface_WINRT(const PaWasapiDeviceInfo *deviceInfo
|
||||||
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
|
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
|
||||||
|
|
||||||
// Wait in busy loop for async operation to complete
|
// 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);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue