func waitForMultipleObjects(handles []syscall.Handle, timeout time.Duration) (int, error) {
	timeoutMillis := uintptr(_INFINITE)
	if timeout >= 0 {
		timeoutMillis = uintptr(timeout.Seconds() * 1000)
	}
	result, _, errno := syscall.Syscall6(
		procWaitForMultipleObjects.Addr(), 4,
		uintptr(len(handles)),
		uintptr(unsafe.Pointer(&handles[0])),
		uintptr(0), // FALSE (don't wait for all)
		timeoutMillis,
		0, 0,
	)
	if result == _WAIT_TIMEOUT {
		return -1, ErrTimeout
	}
	if result >= _WAIT_OBJECT_0 && result < uintptr(_WAIT_OBJECT_0+len(handles)) {
		return int(result - _WAIT_OBJECT_0), nil
	}
	if result >= _WAIT_ABANDONED_0 && result < uintptr(_WAIT_ABANDONED_0+len(handles)) {
		// The thread that owned the mutex exited without releasing the
		// mutex. Ownership of the mutex is still granted as above.
		return int(result - _WAIT_ABANDONED_0), nil
	}
	if errno != 0 {
		return -1, errno
	}
	return -1, syscall.GetLastError()
}
// waitForMultipleObjects calls the WaitForMultipleObjects Windows API, with the
// given handles and timeout. If the timeout value is negative, there is no timeout.
//
// The return value is the index of the handle that was signalled, or an error.
//
// See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).aspx
waitForMultipleObjects calls the WaitForMultipleObjects Windows API, with the
given handles and timeout. If the timeout value is negative, there is no timeout.

The return value is the index of the handle that was signalled, or an error.

msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).aspx
// waitForMultipleObjects calls the WaitForMultipleObjects Windows API with the // given handles and timeout . If the timeout value is negative there is no timeout . // // The return value is the index of the handle that was signalled or an error . // // See : https : // msdn . microsoft . com / en - us / library / windows / desktop / ms687025 ( v = vs . 85 ) . aspx
func waitForMultipleObjects(handles []syscall.Handle, timeout time.Duration) (int, error) {
	timeoutMillis := uintptr(_INFINITE)
	if timeout >= 0 {
		timeoutMillis = uintptr(timeout.Seconds() * 1000)
	}
	result, _, errno := syscall.Syscall6(
		procWaitForMultipleObjects.Addr(), 4,
		uintptr(len(handles)),
		uintptr(unsafe.Pointer(&handles[0])),
		uintptr(0), 
		timeoutMillis,
		0, 0,
	)
	if result == _WAIT_TIMEOUT {
		return -1, ErrTimeout
	}
	if result >= _WAIT_OBJECT_0 && result < uintptr(_WAIT_OBJECT_0+len(handles)) {
		return int(result - _WAIT_OBJECT_0), nil
	}
	if result >= _WAIT_ABANDONED_0 && result < uintptr(_WAIT_ABANDONED_0+len(handles)) {
		return int(result - _WAIT_ABANDONED_0), nil
	}
	if errno != 0 {
		return -1, errno
	}
	return -1, syscall.GetLastError()
}
func waitForMultipleObjects ( handles [ ] syscall . Handle , timeout time . Duration ) ( int , error ) { timeoutMillis := uintptr ( _INFINITE ) if timeout >= 0 { timeoutMillis = uintptr ( timeout . Seconds ( ) * 1000 ) } result , _ , errno := syscall . Syscall6 ( procWaitForMultipleObjects . Addr ( ) , 4 , uintptr ( len ( handles ) ) , uintptr ( unsafe . Pointer ( & handles [ 0 ] ) ) , uintptr ( 0 ) , timeoutMillis , 0 , 0 , ) if result == _WAIT_TIMEOUT { return - 1 , ErrTimeout } if result >= _WAIT_OBJECT_0 && result < uintptr ( _WAIT_OBJECT_0 + len ( handles ) ) { return int ( result - _WAIT_OBJECT_0 ) , nil } if result >= _WAIT_ABANDONED_0 && result < uintptr ( _WAIT_ABANDONED_0 + len ( handles ) ) { return int ( result - _WAIT_ABANDONED_0 ) , nil } if errno != 0 { return - 1 , errno } return - 1 , syscall . GetLastError ( ) }
waitForMultipleObjects calls the WaitForMultipleObjects Windows API, with the
given handles and timeout.
waitForMultipleObjects calls the WaitForMultipleObjects Windows API with the given handles and timeout .
// FALSE (don't wait for all) // The thread that owned the mutex exited without releasing the // mutex. Ownership of the mutex is still granted as above.