Zth (libzth)
Loading...
Searching...
No Matches
sync.h File Reference
#include <libzth/macros.h>
#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::Locked
 Mutex RAII, that locks and unlocks the mutex automatically. 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

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

Macro Definition Documentation

◆ EOVERFLOW

#define EOVERFLOW   EAGAIN

Definition at line 1077 of file sync.h.

Typedef Documentation

◆ zth_future_t_type

typedef zth::Future<uintptr_t> zth_future_t_type

Definition at line 1218 of file sync.h.