Zth (libzth)
sync.h File Reference
#include <libzth/allocator.h>
#include <libzth/fiber.h>
#include <libzth/list.h>
#include <libzth/util.h>
#include <libzth/worker.h>
#include <new>

Go to the source code of this file.

Classes

class  zth::RefCounted
 
class  zth::SharedPointer< T >
 
class  zth::Synchronizer
 
class  zth::Synchronizer::AlarmClock
 
class  zth::Mutex
 Fiber-aware mutex. More...
 
class  zth::Semaphore
 Fiber-aware semaphore. More...
 
class  zth::Signal
 Fiber-aware signal. More...
 
class  zth::Future< T >
 Fiber-aware future. More...
 
class  zth::Future< void >
 
class  zth::Gate
 Fiber-aware barrier/gate. More...
 
struct  zth_mutex_t
 
struct  zth_sem_t
 
struct  zth_cond_t
 
struct  zth_future_t
 
struct  zth_gate_t
 

Namespaces

 zth
 

Macros

#define EOVERFLOW   EAGAIN
 

Typedefs

typedef zth::Future< uintptr_t > zth_future_t_type
 

Functions

int zth_mutex_init (zth_mutex_t *mutex) noexcept
 Initializes a mutex. More...
 
int zth_mutex_destroy (zth_mutex_t *mutex) noexcept
 Destroys a mutex. More...
 
int zth_mutex_lock (zth_mutex_t *mutex) noexcept
 Locks a mutex. More...
 
int zth_mutex_trylock (zth_mutex_t *mutex) noexcept
 Try to lock a mutex. More...
 
int zth_mutex_unlock (zth_mutex_t *mutex) noexcept
 Unlock a mutex. More...
 
int zth_sem_init (zth_sem_t *sem, size_t value) noexcept
 Initializes a semaphore. More...
 
int zth_sem_destroy (zth_sem_t *sem) noexcept
 Destroys a semaphore. More...
 
int zth_sem_getvalue (zth_sem_t *__restrict__ sem, size_t *__restrict__ value) noexcept
 Returns the value of a semaphore. More...
 
int zth_sem_post (zth_sem_t *sem) noexcept
 Increments a semaphore. More...
 
int zth_sem_wait (zth_sem_t *sem) noexcept
 Decrements (or wait for) a semaphore. More...
 
int zth_sem_trywait (zth_sem_t *sem) noexcept
 Try to decrement a semaphore. More...
 
int zth_cond_init (zth_cond_t *cond) noexcept
 Initializes a condition. More...
 
int zth_cond_destroy (zth_cond_t *cond) noexcept
 Destroys a condition. More...
 
int zth_cond_signal (zth_cond_t *cond) noexcept
 Signals one fiber waiting for the condition. More...
 
int zth_cond_broadcast (zth_cond_t *cond) noexcept
 Signals all fibers waiting for the condition. More...
 
int zth_cond_wait (zth_cond_t *cond) noexcept
 Wait for a condition. More...
 
int zth_future_init (zth_future_t *future) noexcept
 Initializes a future. More...
 
int zth_future_destroy (zth_future_t *future) noexcept
 Destroys a future. More...
 
int zth_future_valid (zth_future_t *future) noexcept
 Checks if a future was already set. More...
 
int zth_future_set (zth_future_t *future, uintptr_t value) noexcept
 Sets a future and signals all waiting fibers. More...
 
int zth_future_get (zth_future_t *__restrict__ future, uintptr_t *__restrict__ value) noexcept
 Wait for and return a future's value. More...
 
int zth_future_wait (zth_future_t *future) noexcept
 Wait for a future. More...
 
int zth_gate_init (zth_gate_t *gate, size_t count) noexcept
 Initializes a gate. More...
 
int zth_gate_destroy (zth_gate_t *gate) noexcept
 Destroys a gate. More...
 
int zth_gate_pass (zth_gate_t *gate) noexcept
 Passes a gate. More...
 
int zth_gate_wait (zth_gate_t *gate) noexcept
 Wait for a gate. More...
 

Macro Definition Documentation

◆ EOVERFLOW

#define EOVERFLOW   EAGAIN

Definition at line 951 of file sync.h.

Typedef Documentation

◆ zth_future_t_type

typedef zth::Future<uintptr_t> zth_future_t_type

Definition at line 1092 of file sync.h.