ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
static_rwlock_t Struct Reference

Statically initialized mutex wrapper for globals touched during startup. The embedded mutex carries the platform lock and initialized records whether runtime setup has completed; callers use normal mutex operations after initialization. More...

#include <include/ascii-chat/common/sync.h>

Data Fields

rwlock_t lock
 The actual reader-writer lock.
volatile int initialized
 Thread-safe initialization flag (POSIX: int for atomic operations).

Detailed Description

Statically initialized mutex wrapper for globals touched during startup. The embedded mutex carries the platform lock and initialized records whether runtime setup has completed; callers use normal mutex operations after initialization.

Reader-writer lock wrapper for global state that needs safe static initialization. lock is the platform lock and initialized makes one-time setup visible; the global owner retains it until process shutdown.

Wrapper for a condition variable that must be usable before normal runtime initialization. cond contains the platform primitive and initialized prevents duplicate setup; global owners keep it for the process lifetime rather than freeing it like a heap condition variable.

Static reader-writer lock structure for global rwlocks requiring static initialization

Provides lazy initialization for reader-writer locks that need to work before main(). Uses the same lazy initialization pattern as static_mutex_t for cross-platform compatibility.

Note
The initialized flag is checked atomically before first use to ensure the rwlock is initialized exactly once.

Definition at line 89 of file common/sync.h.

Field Documentation

◆ initialized

volatile int static_rwlock_t::initialized

Thread-safe initialization flag (POSIX: int for atomic operations).

Definition at line 99 of file common/sync.h.

◆ lock

rwlock_t static_rwlock_t::lock

The actual reader-writer lock.

Definition at line 91 of file common/sync.h.


The documentation for this struct was generated from the following file: