Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/recognizer.c:
thread = impl->worker_thread;
impl->worker_thread = INVALID_HANDLE_VALUE;
impl->worker_running = FALSE;
impl->worker_paused = FALSE;
impl->recognizer_state = SpeechRecognizerState_Idle;
- }
- else
invalid_state = TRUE;
- LeaveCriticalSection(&impl->cs);
- if (invalid_state && SUCCEEDED(hr))
hr = COR_E_INVALIDOPERATION;
- else if (!invalid_state)
- {
SetEvent(impl->worker_control_event);
session_join_worker_thread(thread);
```suggestion:-0+0 WaitForSingleObject(thread, INFINITE); CloseHandle(thread); ```
Readers cannot infer that `session_join_worker_thread` closes the given handle from the function's name. Instead of renaming it to `session_join_close_worker_thread`, might as well open code it.