Lightweight condition variable library.
More...
#include <ppu-types.h>
#include <lv2/mutex.h>
Go to the source code of this file.
Lightweight condition variable library.
Definition in file cond.h.
◆ sys_lwcond_attr_t
Lightweight condition variable attributes data structure.
◆ sys_lwcond_t
Lightweight condition variable data structure.
◆ sysLwCondCreate()
Create a lightweight condition variable.
- Parameters
-
| lwcond | Pointer to storage for the created lightweight condition variable. |
| lwmutex | Pointer to the associated lightweight mutex. |
| attr | Pointer to the attributes data structure. |
- Returns
- zero if no error occured, nonzero otherwise.
◆ sysLwCondDestroy()
Destroy a lightweight condition variable.
- Parameters
-
| lwcond | Pointer to the allocated lightweight condition variable. |
- Returns
- zero if no error occured, nonzero otherwise.
◆ sysLwCondSignal()
Signal a lightweight condition variable.
- Parameters
-
| lwcond | Pointer to the allocated lightweight condition variable. |
- Returns
- zero if no error occured, nonzero otherwise.
◆ sysLwCondSignalAll()
Signal a lightweight condition variable to all waiting PPU threads.
- Parameters
-
| lwcond | Pointer to the allocated lightweight condition variable. |
- Returns
- zero if no error occured, nonzero otherwise.
◆ sysLwCondSignalTo()
| s32 sysLwCondSignalTo |
( |
sys_lwcond_t * |
lwcond, |
|
|
sys_ppu_thread_t |
thr |
|
) |
| |
Signal a lightweight condition variable to a specific PPU thread.
- Parameters
-
| lwcond | Pointer to the allocated lightweight condition variable. |
| thr | The PPU thread id. |
- Returns
- zero if no error occured, nonzero otherwise.
◆ sysLwCondWait()
| s32 sysLwCondWait |
( |
sys_lwcond_t * |
lwcond, |
|
|
u64 |
timeout_usec |
|
) |
| |
Wait for a lightweight condition variable to be signaled.
The associated lightweight mutex must have been previously locked by the calling thread. This function atomically unlocks the mutex and waits for the condition variable to be signaled. Before returning to the calling thread, this function re-acquires the mutex.
- Parameters
-
| lwcond | Pointer to the allocated lightweight condition variable. |
| timeout_usec | Timeout value in microseconds, or 0 if no timeout is used. |
- Returns
- zero if the lightweight condition variable was signaled, nonzero in case of error or if a timeout occured.