Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_event.c:
EnterCriticalSection(&event_thread_cs);
if (event_queue != event_thread.event_queue)
{
*event_thread_shutdown = TRUE;
LeaveCriticalSection(&event_thread_cs);
}
- }
- if (!list_empty(event_queue))
- {
queue_event = LIST_ENTRY(list_head(event_queue), struct uia_queue_event, event_queue_entry);
list_remove(list_head(event_queue));
- }
- if (!*event_thread_shutdown)
LeaveCriticalSection(&event_thread_cs);
I don't think the very slight optimization here is worth the complexity of two different LeaveCriticalSection calls.