wait_on_handle -async crashes on invalid handles
Brought to you by:
apnadkarni
If wait_on_handle -async is called with an invalid handle, program crashes. Moreover, note that MSDN says behaviour is undefined if a previous handle is closed while the wait is active (RegisterWaitForObject).
Protect against this by either internally maintaining handle list (currently we rely on Windows API validating handles) or by checking validity through GetHandleInfo before calling Register*
Anonymous