ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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 72 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 80 of file common/sync.h.

◆ lock

rwlock_t static_rwlock_t::lock

The actual reader-writer lock.

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


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