libnx  v4.7.0
Typedefs | Functions
condvar.h File Reference

Condition variable synchronization primitive. More...

#include "../types.h"
#include "../kernel/svc.h"
#include "../kernel/mutex.h"

Go to the source code of this file.

Typedefs

typedef u32 CondVar
 Condition variable.
 

Functions

static void condvarInit (CondVar *c)
 Initializes a condition variable. More...
 
Result condvarWaitTimeout (CondVar *c, Mutex *m, u64 timeout)
 Waits on a condition variable with a timeout. More...
 
static Result condvarWait (CondVar *c, Mutex *m)
 Waits on a condition variable. More...
 
static Result condvarWake (CondVar *c, int num)
 Wakes up up to the specified number of threads waiting on a condition variable. More...
 
static Result condvarWakeOne (CondVar *c)
 Wakes up a single thread waiting on a condition variable. More...
 
static Result condvarWakeAll (CondVar *c)
 Wakes up all thread waiting on a condition variable. More...
 

Detailed Description

Condition variable synchronization primitive.

Author
plutoo

Function Documentation

◆ condvarInit()

static void condvarInit ( CondVar c)
inlinestatic

Initializes a condition variable.

Parameters
[in]cCondition variable object.

◆ condvarWait()

static Result condvarWait ( CondVar c,
Mutex m 
)
inlinestatic

Waits on a condition variable.

Parameters
[in]cCondition variable object.
[in]mMutex object to use inside the condition variable.
Returns
Result code.
Remarks
On function return, the underlying mutex is acquired.

◆ condvarWaitTimeout()

Result condvarWaitTimeout ( CondVar c,
Mutex m,
u64  timeout 
)

Waits on a condition variable with a timeout.

Parameters
[in]cCondition variable object.
[in]mMutex object to use inside the condition variable.
[in]timeoutTimeout in nanoseconds.
Returns
Result code (0xEA01 on timeout).
Remarks
On function return, the underlying mutex is acquired.

◆ condvarWake()

static Result condvarWake ( CondVar c,
int  num 
)
inlinestatic

Wakes up up to the specified number of threads waiting on a condition variable.

Parameters
[in]cCondition variable object.
[in]numMaximum number of threads to wake up (or -1 to wake them all up).
Returns
Result code.

◆ condvarWakeAll()

static Result condvarWakeAll ( CondVar c)
inlinestatic

Wakes up all thread waiting on a condition variable.

Parameters
[in]cCondition variable object.
Returns
Result code.

◆ condvarWakeOne()

static Result condvarWakeOne ( CondVar c)
inlinestatic

Wakes up a single thread waiting on a condition variable.

Parameters
[in]cCondition variable object.
Returns
Result code.