ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
rwlock.h File Reference

Cross-platform read-write lock interface for ascii-chat. More...

Go to the source code of this file.

Data Structures

struct  rwlock_t
 Read-write lock type (POSIX: pthread_rwlock_t with debug tracking) More...
 

Macros

#define LOG_RWLOCK_STATE(rwlock)   rwlock_log_state(rwlock, __FILE__, __LINE__, __func__)
 
Read-Write Lock Macros
#define rwlock_rdlock(lock)    (debug_sync_is_initialized() ? debug_sync_rwlock_rdlock(lock, __FILE__, __LINE__, __func__) : rwlock_rdlock_impl(lock))
 Acquire a read lock (with debug tracking in debug builds)
 
#define rwlock_wrlock(lock)    (debug_sync_is_initialized() ? debug_sync_rwlock_wrlock(lock, __FILE__, __LINE__, __func__) : rwlock_wrlock_impl(lock))
 Acquire a write lock (with debug tracking in debug builds)
 
#define rwlock_rdunlock(lock)    (debug_sync_is_initialized() ? debug_sync_rwlock_rdunlock(lock, __FILE__, __LINE__, __func__) : rwlock_rdunlock_impl(lock))
 Release a read lock (with debug tracking in debug builds)
 
#define rwlock_wrunlock(lock)    (debug_sync_is_initialized() ? debug_sync_rwlock_wrunlock(lock, __FILE__, __LINE__, __func__) : rwlock_wrunlock_impl(lock))
 Release a write lock (with debug tracking in debug builds)
 

Functions

bool debug_sync_is_initialized (void)
 
int debug_sync_rwlock_rdlock (rwlock_t *rwlock, const char *file_name, int line_number, const char *function_name)
 
int debug_sync_rwlock_wrlock (rwlock_t *rwlock, const char *file_name, int line_number, const char *function_name)
 
int debug_sync_rwlock_rdunlock (rwlock_t *rwlock, const char *file_name, int line_number, const char *function_name)
 
int debug_sync_rwlock_wrunlock (rwlock_t *rwlock, const char *file_name, int line_number, const char *function_name)
 
int rwlock_init (rwlock_t *lock, const char *name)
 Initialize a read-write lock with a name.
 
int rwlock_destroy (rwlock_t *lock)
 Destroy a read-write lock.
 
void rwlock_on_rdlock (rwlock_t *rwlock)
 Hook called when a read lock is successfully acquired.
 
void rwlock_on_wrlock (rwlock_t *rwlock)
 Hook called when a write lock is successfully acquired.
 
void rwlock_on_unlock (rwlock_t *rwlock)
 Hook called when an rwlock is unlocked (read or write)
 
void rwlock_log_state (const rwlock_t *rwlock, const char *file, int line, const char *func)
 Log the state of a read-write lock.
 
int rwlock_init_impl (rwlock_t *lock)
 Initialize a read-write lock (implementation function)
 
int rwlock_destroy_impl (rwlock_t *lock)
 Destroy a read-write lock (implementation function)
 
int rwlock_rdlock_impl (rwlock_t *lock)
 Acquire a read lock (implementation function)
 
int rwlock_wrlock_impl (rwlock_t *lock)
 Acquire a write lock (implementation function)
 
int rwlock_rdunlock_impl (rwlock_t *lock)
 Release a read lock (implementation function)
 
int rwlock_wrunlock_impl (rwlock_t *lock)
 Release a write lock (implementation function)
 

Detailed Description

Cross-platform read-write lock interface for ascii-chat.

Definition in file rwlock.h.