implementing WaitForAnyHandle / single threaded approach