libnx  v4.8.0
Data Structures | Macros | Typedefs | Enumerations | Functions
wait.h File Reference

User mode synchronization primitive waiting operations. More...

#include "mutex.h"

Go to the source code of this file.

Data Structures

struct  WaitableNode
 
struct  Waitable
 
struct  Waiter
 Waiter structure, representing any generic waitable synchronization object; both kernel-mode and user-mode. More...
 

Macros

#define waitMulti(idx_out, timeout, ...)
 Helper macro for waitObjects that accepts Waiter structures as variadic arguments instead of as an array. More...
 
#define waitMultiHandle(idx_out, timeout, ...)
 Helper macro for waitHandles that accepts handles as variadic arguments instead of as an array. More...
 

Typedefs

typedef struct WaitableMethods WaitableMethods
 

Enumerations

enum  WaiterType {
  WaiterType_Handle ,
  WaiterType_HandleWithClear ,
  WaiterType_Waitable
}
 

Functions

static Waiter waiterForHandle (Handle h)
 Creates a Waiter for a kernel-mode Handle.
 
Result waitObjects (s32 *idx_out, const Waiter *objects, s32 num_objects, u64 timeout)
 Waits for an arbitrary number of generic waitable synchronization objects, optionally with a timeout. More...
 
Result waitHandles (s32 *idx_out, const Handle *handles, s32 num_handles, u64 timeout)
 Waits for an arbitrary number of kernel synchronization objects, optionally with a timeout. More...
 
static Result waitSingle (Waiter w, u64 timeout)
 Waits on a single generic waitable synchronization object, optionally with a timeout. More...
 
static Result waitSingleHandle (Handle h, u64 timeout)
 Waits for a single kernel synchronization object, optionally with a timeout. More...
 

Detailed Description

User mode synchronization primitive waiting operations.

Author
plutoo

Macro Definition Documentation

◆ waitMulti

#define waitMulti (   idx_out,
  timeout,
  ... 
)
Value:
({ \
Waiter __objects[] = { __VA_ARGS__ }; \
waitObjects((idx_out), __objects, sizeof(__objects) / sizeof(Waiter), (timeout)); \
})
Waiter structure, representing any generic waitable synchronization object; both kernel-mode and user...
Definition: wait.h:36

Helper macro for waitObjects that accepts Waiter structures as variadic arguments instead of as an array.

Parameters
[out]idx_outThe index of the signalled waiter.
[in]timeoutTimeout (in nanoseconds).
Note
The number of objects must not be greater than MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.

◆ waitMultiHandle

#define waitMultiHandle (   idx_out,
  timeout,
  ... 
)
Value:
({ \
Handle __handles[] = { __VA_ARGS__ }; \
waitHandles((idx_out), __handles, sizeof(__handles) / sizeof(Handle), (timeout)); \
})
u32 Handle
Kernel object handle.
Definition: types.h:43

Helper macro for waitHandles that accepts handles as variadic arguments instead of as an array.

Parameters
[out]idx_outThe index of the signalled handle.
[in]timeoutTimeout (in nanoseconds).
Note
The number of objects must not be greater than MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.

Function Documentation

◆ waitHandles()

Result waitHandles ( s32 idx_out,
const Handle handles,
s32  num_handles,
u64  timeout 
)

Waits for an arbitrary number of kernel synchronization objects, optionally with a timeout.

This function replaces svcWaitSynchronization.

Parameters
[out]idx_outVariable that will received the index of the signalled object.
[in]handlesArray containing handles.
[in]num_handlesNumber of handles in the array.
[in]timeoutTimeout (in nanoseconds).
Returns
Result code.
Note
The number of objects must not be greater than MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.

◆ waitObjects()

Result waitObjects ( s32 idx_out,
const Waiter objects,
s32  num_objects,
u64  timeout 
)

Waits for an arbitrary number of generic waitable synchronization objects, optionally with a timeout.

Parameters
[out]idx_outVariable that will received the index of the signalled object.
[in]objectsArray containing Waiter structures.
[in]num_objectsNumber of objects in the array.
[in]timeoutTimeout (in nanoseconds).
Returns
Result code.
Note
The number of objects must not be greater than MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.

◆ waitSingle()

static Result waitSingle ( Waiter  w,
u64  timeout 
)
inlinestatic

Waits on a single generic waitable synchronization object, optionally with a timeout.

Parameters
[in]wWaiter structure.
[in]timeoutTimeout (in nanoseconds).

◆ waitSingleHandle()

static Result waitSingleHandle ( Handle  h,
u64  timeout 
)
inlinestatic

Waits for a single kernel synchronization object, optionally with a timeout.

Parameters
[in]hHandle of the object.
[in]timeoutTimeout (in nanoseconds).