WaitForMultipleObjects function kernel32

Win32Result<WAIT_EVENT> WaitForMultipleObjects(
  1. int nCount,
  2. Pointer<Pointer<NativeType>> lpHandles,
  3. bool bWaitAll,
  4. int dwMilliseconds,
)

Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses.

To learn more, see learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects.

Implementation

Win32Result<WAIT_EVENT> WaitForMultipleObjects(
  int nCount,
  Pointer<Pointer> lpHandles,
  bool bWaitAll,
  int dwMilliseconds,
) {
  final result_ = WaitForMultipleObjects_Wrapper(
    nCount,
    lpHandles,
    bWaitAll ? TRUE : FALSE,
    dwMilliseconds,
  );
  return Win32Result(
    value: WAIT_EVENT(result_.value.u32),
    error: result_.error,
  );
}