6 Sep
2022
6 Sep
'22
5:38 a.m.
R��mi Bernon (@rbernon) commented about dlls/windows.media.speech/recognizer.c:
+ running = impl->session_running; + LeaveCriticalSection(&impl->cs); + + /* TODO: Send mic data to recognizer. */ + + if (paused) + { + TRACE("paused!\n"); + SetEvent(impl->session_paused_event); + WaitForSingleObject(impl->session_resume_event, INFINITE); + } + + Sleep(500); /* Sleep to slow down spinning for now. */ + } + + return 0; I believe a more canonical way to write this thread would be something like:
EnterCriticalSection(&impl->cs);
while (impl->session_running)
{
if (impl->session_paused)
{
SleepConditionVariableCS(&impl->cv, &impl->cs, INFINITE);
continue;
}
/* TODO: Send mic data to recognizer. */
Sleep(500); /* Sleep to slow down spinning for now. */
}
LeaveCriticalSection(&impl->cs);
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/729#note_7746