Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/recognizer.c:
}
static HRESULT WINAPI session_StartAsync( ISpeechContinuousRecognitionSession *iface, IAsyncAction **action ) {
- FIXME("iface %p, action %p stub!\n", iface, action);
- return async_action_create(NULL, start_callback, action);
- struct session *impl = impl_from_ISpeechContinuousRecognitionSession(iface);
- BOOLEAN invalid_state = FALSE;
- HRESULT hr = S_OK;
- TRACE("iface %p, action %p.\n", iface, action);
- *action = NULL;
- EnterCriticalSection(&impl->cs);
- if (!impl->worker_running && !impl->worker_thread && SUCCEEDED(hr = async_action_create(NULL, session_start_async, action)))
`async_action_create` should be taken out of the critical section. In general, minimize the number of potentially failing or blocking operations inside a critical section (ideally to zero).