Semaphores, Mutexes and Conditions. More...
#include "../imquic/debug.h"
Go to the source code of this file.
Macros | |
#define | imquic_mutex_init(a) g_mutex_init(a) |
imquic mutex initialization | |
#define | IMQUIC_MUTEX_INITIALIZER {0} |
imquic static mutex initializer | |
#define | imquic_mutex_destroy(a) g_mutex_clear(a) |
imquic mutex destruction | |
#define | imquic_mutex_lock_nodebug(a) g_mutex_lock(a) |
imquic mutex lock without debug | |
#define | imquic_mutex_lock_debug(a) { IMQUIC_PRINT("[%s:%s:%d:lock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_lock(a); } |
imquic mutex lock with debug (prints the line that locked a mutex) | |
#define | imquic_mutex_lock(a) { if(!imquic_lock_debug) { imquic_mutex_lock_nodebug(a); } else { imquic_mutex_lock_debug(a); } } |
imquic mutex lock wrapper (selective locking debug) | |
#define | imquic_mutex_trylock_nodebug(a) { ret = g_mutex_trylock(a); } |
imquic mutex try lock without debug | |
#define | imquic_mutex_trylock_debug(a) { IMQUIC_PRINT("[%s:%s:%d:trylock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); ret = g_mutex_trylock(a); } |
imquic mutex try lock with debug (prints the line that tried to lock a mutex) | |
#define | imquic_mutex_trylock(a) ({ gboolean ret; if(!imquic_lock_debug) { imquic_mutex_trylock_nodebug(a); } else { imquic_mutex_trylock_debug(a); } ret; }) |
imquic mutex try lock wrapper (selective locking debug) | |
#define | imquic_mutex_unlock_nodebug(a) g_mutex_unlock(a) |
imquic mutex unlock without debug | |
#define | imquic_mutex_unlock_debug(a) { IMQUIC_PRINT("[%s:%s:%d:unlock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_unlock(a); } |
imquic mutex unlock with debug (prints the line that unlocked a mutex) | |
#define | imquic_mutex_unlock(a) { if(!imquic_lock_debug) { imquic_mutex_unlock_nodebug(a); } else { imquic_mutex_unlock_debug(a); } } |
imquic mutex unlock wrapper (selective locking debug) | |
#define | imquic_condition_init(a) g_cond_init(a) |
imquic condition initialization | |
#define | imquic_condition_destroy(a) g_cond_clear(a) |
imquic condition destruction | |
#define | imquic_condition_wait(a, b) g_cond_wait(a, b); |
imquic condition wait | |
#define | imquic_condition_wait_until(a, b, c) g_cond_wait_until(a, b, c); |
imquic condition wait until | |
#define | imquic_condition_signal(a) g_cond_signal(a); |
imquic condition signal | |
#define | imquic_condition_broadcast(a) g_cond_broadcast(a); |
imquic condition broadcast | |
Typedefs | |
typedef GMutex | imquic_mutex |
imquic mutex implementation | |
typedef GCond | imquic_condition |
imquic condition implementation | |
Variables | |
gboolean | imquic_lock_debug |
Semaphores, Mutexes and Conditions.
Implementation (based on GMutex) of a locking mechanism based on mutexes and conditions.
#define imquic_condition_broadcast | ( | a | ) | g_cond_broadcast(a); |
imquic condition broadcast
#define imquic_condition_destroy | ( | a | ) | g_cond_clear(a) |
imquic condition destruction
#define imquic_condition_init | ( | a | ) | g_cond_init(a) |
imquic condition initialization
#define imquic_condition_signal | ( | a | ) | g_cond_signal(a); |
imquic condition signal
#define imquic_condition_wait | ( | a, | |
b ) g_cond_wait(a, b); |
imquic condition wait
#define imquic_condition_wait_until | ( | a, | |
b, | |||
c ) g_cond_wait_until(a, b, c); |
imquic condition wait until
#define imquic_mutex_destroy | ( | a | ) | g_mutex_clear(a) |
imquic mutex destruction
#define imquic_mutex_init | ( | a | ) | g_mutex_init(a) |
imquic mutex initialization
#define IMQUIC_MUTEX_INITIALIZER {0} |
imquic static mutex initializer
#define imquic_mutex_lock | ( | a | ) | { if(!imquic_lock_debug) { imquic_mutex_lock_nodebug(a); } else { imquic_mutex_lock_debug(a); } } |
imquic mutex lock wrapper (selective locking debug)
#define imquic_mutex_lock_debug | ( | a | ) | { IMQUIC_PRINT("[%s:%s:%d:lock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_lock(a); } |
imquic mutex lock with debug (prints the line that locked a mutex)
#define imquic_mutex_lock_nodebug | ( | a | ) | g_mutex_lock(a) |
imquic mutex lock without debug
#define imquic_mutex_trylock | ( | a | ) | ({ gboolean ret; if(!imquic_lock_debug) { imquic_mutex_trylock_nodebug(a); } else { imquic_mutex_trylock_debug(a); } ret; }) |
imquic mutex try lock wrapper (selective locking debug)
#define imquic_mutex_trylock_debug | ( | a | ) | { IMQUIC_PRINT("[%s:%s:%d:trylock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); ret = g_mutex_trylock(a); } |
imquic mutex try lock with debug (prints the line that tried to lock a mutex)
#define imquic_mutex_trylock_nodebug | ( | a | ) | { ret = g_mutex_trylock(a); } |
imquic mutex try lock without debug
#define imquic_mutex_unlock | ( | a | ) | { if(!imquic_lock_debug) { imquic_mutex_unlock_nodebug(a); } else { imquic_mutex_unlock_debug(a); } } |
imquic mutex unlock wrapper (selective locking debug)
#define imquic_mutex_unlock_debug | ( | a | ) | { IMQUIC_PRINT("[%s:%s:%d:unlock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_unlock(a); } |
imquic mutex unlock with debug (prints the line that unlocked a mutex)
#define imquic_mutex_unlock_nodebug | ( | a | ) | g_mutex_unlock(a) |
imquic mutex unlock without debug
typedef GCond imquic_condition |
imquic condition implementation
typedef GMutex imquic_mutex |
imquic mutex implementation
|
extern |