def _wait_for_handles(handles, timeout=(-1)):
 arrtype = (HANDLE * len(handles))
 handle_array = arrtype(*handles)
 ret = windll.kernel32.WaitForMultipleObjects(len(handle_array), handle_array, BOOL(False), DWORD(timeout))
 if (ret == WAIT_TIMEOUT):
  return None
 else:
  h = handle_array[ret]
  return h

def _wait_for_handles ( handles , timeout = ( - 1 ) ) : arrtype = ( HANDLE * len ( handles ) ) handle_array = arrtype ( * handles ) ret = windll . kernel32 . WaitForMultipleObjects ( len ( handle_array ) , handle_array , BOOL ( False ) , DWORD ( timeout ) ) if ( ret == WAIT_TIMEOUT ) : return None else : h = handle_array [ ret ] return h
waits for multiple handles .