Semaphores, Mutexes and Conditions. More...
Go to the source code of this file.
Macros | |
#define | janus_mutex_init(a) g_mutex_init(a) |
Janus mutex initialization. | |
#define | JANUS_MUTEX_INITIALIZER {0} |
Janus static mutex initializer. | |
#define | janus_mutex_destroy(a) g_mutex_clear(a) |
Janus mutex destruction. | |
#define | janus_mutex_lock_nodebug(a) g_mutex_lock(a) |
Janus mutex lock without debug. | |
#define | janus_mutex_lock_debug(a) { JANUS_PRINT("[%s:%s:%d:lock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_lock(a); } |
Janus mutex lock with debug (prints the line that locked a mutex) | |
#define | janus_mutex_lock(a) { if(!lock_debug) { janus_mutex_lock_nodebug(a); } else { janus_mutex_lock_debug(a); } } |
Janus mutex lock wrapper (selective locking debug) | |
#define | janus_mutex_trylock_nodebug(a) { ret = g_mutex_trylock(a); } |
Janus mutex try lock without debug. | |
#define | janus_mutex_trylock_debug(a) { JANUS_PRINT("[%s:%s:%d:trylock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); ret = g_mutex_trylock(a); } |
Janus mutex try lock with debug (prints the line that tried to lock a mutex) | |
#define | janus_mutex_trylock(a) ({ gboolean ret; if(!lock_debug) { janus_mutex_trylock_nodebug(a); } else { janus_mutex_trylock_debug(a); } ret; }) |
Janus mutex try lock wrapper (selective locking debug) | |
#define | janus_mutex_unlock_nodebug(a) g_mutex_unlock(a) |
Janus mutex unlock without debug. | |
#define | janus_mutex_unlock_debug(a) { JANUS_PRINT("[%s:%s:%d:unlock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_unlock(a); } |
Janus mutex unlock with debug (prints the line that unlocked a mutex) | |
#define | janus_mutex_unlock(a) { if(!lock_debug) { janus_mutex_unlock_nodebug(a); } else { janus_mutex_unlock_debug(a); } } |
Janus mutex unlock wrapper (selective locking debug) | |
#define | janus_condition_init(a) g_cond_init(a) |
Janus condition initialization. | |
#define | janus_condition_destroy(a) g_cond_clear(a) |
Janus condition destruction. | |
#define | janus_condition_wait(a, b) g_cond_wait(a, b); |
Janus condition wait. | |
#define | janus_condition_wait_until(a, b, c) g_cond_wait_until(a, b, c); |
Janus condition wait until. | |
#define | janus_condition_signal(a) g_cond_signal(a); |
Janus condition signal. | |
#define | janus_condition_broadcast(a) g_cond_broadcast(a); |
Janus condition broadcast. | |
Typedefs | |
typedef GMutex | janus_mutex |
Janus mutex implementation. | |
typedef GCond | janus_condition |
Janus condition implementation. | |
Variables | |
int | lock_debug |
Semaphores, Mutexes and Conditions.
Implementation (based on GMutex or pthread_mutex) of a locking mechanism based on mutexes and conditions.
#define janus_condition_broadcast | ( | a | ) | g_cond_broadcast(a); |
Janus condition broadcast.
#define janus_condition_destroy | ( | a | ) | g_cond_clear(a) |
Janus condition destruction.
#define janus_condition_init | ( | a | ) | g_cond_init(a) |
Janus condition initialization.
#define janus_condition_signal | ( | a | ) | g_cond_signal(a); |
Janus condition signal.
#define janus_condition_wait | ( | a, | |
b ) g_cond_wait(a, b); |
Janus condition wait.
#define janus_condition_wait_until | ( | a, | |
b, | |||
c ) g_cond_wait_until(a, b, c); |
Janus condition wait until.
#define janus_mutex_destroy | ( | a | ) | g_mutex_clear(a) |
Janus mutex destruction.
#define janus_mutex_init | ( | a | ) | g_mutex_init(a) |
Janus mutex initialization.
#define JANUS_MUTEX_INITIALIZER {0} |
Janus static mutex initializer.
#define janus_mutex_lock | ( | a | ) | { if(!lock_debug) { janus_mutex_lock_nodebug(a); } else { janus_mutex_lock_debug(a); } } |
Janus mutex lock wrapper (selective locking debug)
#define janus_mutex_lock_debug | ( | a | ) | { JANUS_PRINT("[%s:%s:%d:lock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_lock(a); } |
Janus mutex lock with debug (prints the line that locked a mutex)
#define janus_mutex_lock_nodebug | ( | a | ) | g_mutex_lock(a) |
Janus mutex lock without debug.
#define janus_mutex_trylock | ( | a | ) | ({ gboolean ret; if(!lock_debug) { janus_mutex_trylock_nodebug(a); } else { janus_mutex_trylock_debug(a); } ret; }) |
Janus mutex try lock wrapper (selective locking debug)
#define janus_mutex_trylock_debug | ( | a | ) | { JANUS_PRINT("[%s:%s:%d:trylock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); ret = g_mutex_trylock(a); } |
Janus mutex try lock with debug (prints the line that tried to lock a mutex)
#define janus_mutex_trylock_nodebug | ( | a | ) | { ret = g_mutex_trylock(a); } |
Janus mutex try lock without debug.
#define janus_mutex_unlock | ( | a | ) | { if(!lock_debug) { janus_mutex_unlock_nodebug(a); } else { janus_mutex_unlock_debug(a); } } |
Janus mutex unlock wrapper (selective locking debug)
#define janus_mutex_unlock_debug | ( | a | ) | { JANUS_PRINT("[%s:%s:%d:unlock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_unlock(a); } |
Janus mutex unlock with debug (prints the line that unlocked a mutex)
#define janus_mutex_unlock_nodebug | ( | a | ) | g_mutex_unlock(a) |
Janus mutex unlock without debug.
typedef GCond janus_condition |
Janus condition implementation.
typedef GMutex janus_mutex |
Janus mutex implementation.
|
extern |