Threading management module

This module features common threading and blocking principles. It contains thread merge operation based on stb_sync, as well as CPU affinity management.

Classes

struct zpl_atomic32
struct zpl_async_ctl
struct zpl_thread
struct zpl_sync

Typedefs

using zpl_thread_proc = zpl_isize(*)(struct zpl_thread*thread)
using zpl_async_cb = void(*)(void*data)
using zpl_thread = struct zpl_thread
using zpl_sync = struct zpl_sync

Functions

auto __attribute__((aligned(4))) -> struct zpl_atomic32
__attribute__((aligned(8)))
__attribute__((aligned(ZPL_ATOMIC_PTR_ALIGNMENT)))
auto zpl_mutex_init(zpl_mutex* m) -> void
auto zpl_mutex_destroy(zpl_mutex* m) -> void
auto zpl_mutex_lock(zpl_mutex* m) -> void
auto zpl_mutex_try_lock(zpl_mutex* m) -> zpl_b32
auto zpl_mutex_unlock(zpl_mutex* m) -> void
auto zpl_thread_init(zpl_thread* t) -> void
auto zpl_thread_destroy(zpl_thread* t) -> void
auto zpl_thread_start(zpl_thread* t, zpl_thread_proc proc, void* data) -> void
auto zpl_thread_start_with_stack(zpl_thread* t, zpl_thread_proc proc, void* data, zpl_isize stack_size) -> void
auto zpl_thread_join(zpl_thread* t) -> void
auto zpl_thread_is_running(zpl_thread const* t) -> zpl_b32
auto zpl_thread_current_id(void) -> zpl_u32
auto zpl_thread_set_name(zpl_thread* t, char const* name) -> void
auto zpl_sync_init(zpl_sync* s) -> void
auto zpl_sync_destroy(zpl_sync* s) -> void
auto zpl_sync_set_target(zpl_sync* s, zpl_i32 count) -> void
auto zpl_sync_release(zpl_sync* s) -> void
auto zpl_sync_reach(zpl_sync* s) -> zpl_i32
auto zpl_sync_reach_and_wait(zpl_sync* s) -> void
auto zpl_affinity_init(zpl_affinity* a) -> void
auto zpl_affinity_destroy(zpl_affinity* a) -> void
auto zpl_affinity_set(zpl_affinity* a, zpl_isize core, zpl_isize thread) -> zpl_b32
auto zpl_affinity_thread_count_for_core(zpl_affinity* a, zpl_isize core) -> zpl_isize

Variables

typedef __attribute__
zpl_mutex

Defines

#define zpl_async(data, work, cb)