libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Functions
condvar.h File Reference

Condition variables. More...

#include <libtransistor/types.h>
#include <libtransistor/mutex.h>
Include dependency graph for condvar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  trn_condvar_t
 

Macros

#define TRN_CONDVAR_STATIC_INITIALIZER   {.key = 0}
 

Functions

void trn_condvar_create (trn_condvar_t *condvar)
 Creates a condition variable. More...
 
result_t trn_condvar_signal (trn_condvar_t *condvar, int n)
 Signals n threads waiting on the condition variable, or -1 for all of them.
 
result_t trn_condvar_wait (trn_condvar_t *condvar, trn_mutex_t *mutex, uint64_t timeout) REQUIRES(mutex)
 Waits for the condition variable to be signalled. More...
 
void trn_condvar_destroy (trn_condvar_t *condvar)
 Destroys a condition variable.
 

Detailed Description

Condition variables.

Function Documentation

void trn_condvar_create ( trn_condvar_t condvar)

Creates a condition variable.

Alternatively, a statically allocated condition variable may be initialized with /ref TRN_CONDVAR_STATIC_INITIALIZER

result_t trn_condvar_wait ( trn_condvar_t condvar,
trn_mutex_t *  mutex,
uint64_t  timeout 
)

Waits for the condition variable to be signalled.

Parameters
timeoutHow long (in nanoseconds) to wait, or -1 for no timeout