ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
Lifecycle with Sync Primitives

Combined lifecycle + sync primitive initialization and shutdown.

Combined lifecycle + sync primitive initialization and shutdown.

When lifecycle_t.sync_type is set (e.g., LIFECYCLE_SYNC_MUTEX), the lifecycle functions automatically initialize/destroy the associated sync primitive. No separate function calls needed - one if statement in one place handles all types.

Example (mutex): static mutex_t g_mutex; static lifecycle_t g_lc = LIFECYCLE_INIT_MUTEX(&g_mutex);

if (lifecycle_init(&g_lc, "my_mutex")) { // Mutex is initialized, do init work }

if (lifecycle_shutdown(&g_lc)) { // Mutex is destroyed, do shutdown work }