func (c *CGoSystem) WaitMany(handles []uint32, signals []uint32, deadline uint64) (uint32, int, []uint32, []uint32) { if len(handles) == 0 { r := C.MojoWaitMany(nil, nil, 0, C.MojoDeadline(deadline), nil, nil) return uint32(r), -1, nil, nil } if len(handles) != len(signals) { panic("number of handles and signals must match") } index := ^C.uint32_t(0) // -1 cHandles := (*C.MojoHandle)(unsafe.Pointer(&handles[0])) cSignals := (*C.MojoHandleSignals)(unsafe.Pointer(&signals[0])) cStates := make([]C.struct_MojoHandleSignalsState, len(handles)) r := C.MojoWaitMany(cHandles, cSignals, C.uint32_t(len(handles)), C.MojoDeadline(deadline), &index, &cStates[0]) var satisfied, satisfiable []uint32 if r != C.MOJO_RESULT_INVALID_ARGUMENT && r != C.MOJO_RESULT_RESOURCE_EXHAUSTED { satisfied = make([]uint32, len(handles)) satisfiable = make([]uint32, len(handles)) for i := 0; i < len(handles); i++ { satisfied[i] = uint32(cStates[i].satisfied_signals) satisfiable[i] = uint32(cStates[i].satisfiable_signals) } } return uint32(r), int(int32(index)), satisfied, satisfiable }
func (c *CoreImpl) WaitMany(handles []MojoHandle, signals []MojoHandleSignals, deadline MojoDeadline) MojoResult { return (MojoResult)(C.MojoWaitMany(cArrayMojoHandle(handles), cArrayMojoHandleSignals(signals), (C.uint32_t)(len(handles)), deadline.cType())) }