The GetWorkItemCount implementation may look strange. It's done this way because of how WaitForAllItems is implemented. Alternative solution is to introduce separate counter for GetWorkItemCount. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/272