On Fri Jan 6 18:02:19 2023 +0000, Bernhard Kölbl wrote:
What if I set `impl->worker_running = TRUE;` before the worker loop? That would mean it's only set when the worker is truly running. It would also mean it runs at least one cycle, but I think that can be ignored?
EnterCriticalSection(&impl->cs); impl->worker_running = TRUE; while (impl->worker_running) { /* TODO: Send mic data to recognizer and handle results. */ SleepConditionVariableCS(&impl->cv, &impl->cs, 500); /* Wait 500ms to slow down spinning for now. */ } LeaveCriticalSection(&impl->cs);
You should set `worker_running = TRUE` after thread creation succeds in `session_start_async`.