Semaphors, Mutexes and Conditions.
More...
#include <pthread.h>
#include <errno.h>
#include "debug.h"
Go to the source code of this file.
|
#define | janus_mutex_init(a) g_mutex_init(a) |
| Janus mutex initialization. More...
|
|
#define | JANUS_MUTEX_INITIALIZER {0} |
| Janus static mutex initializer. More...
|
|
#define | janus_mutex_destroy(a) g_mutex_clear(a) |
| Janus mutex destruction. More...
|
|
#define | janus_mutex_lock_nodebug(a) g_mutex_lock(a); |
| Janus mutex lock without debug. More...
|
|
#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) More...
|
|
#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) More...
|
|
#define | janus_mutex_unlock_nodebug(a) g_mutex_unlock(a); |
| Janus mutex unlock without debug. More...
|
|
#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) More...
|
|
#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) More...
|
|
#define | janus_condition_init(a) g_cond_init(a) |
| Janus condition initialization. More...
|
|
#define | janus_condition_destroy(a) g_cond_clear(a) |
| Janus condition destruction. More...
|
|
#define | janus_condition_wait(a, b) g_cond_wait(a, b); |
| Janus condition wait. More...
|
|
#define | janus_condition_wait_until(a, b, c) g_cond_wait_until(a, b, c); |
| Janus condition wait until. More...
|
|
#define | janus_condition_signal(a) g_cond_signal(a); |
| Janus condition signal. More...
|
|
#define | janus_condition_broadcast(a) g_cond_broadcast(a); |
| Janus condition broadcast. More...
|
|
Semaphors, Mutexes and Conditions.
- Author
- Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om
Implementation (based on GMutex or pthread_mutex) of a locking mechanism based on mutexes and conditions.
Core
◆ janus_condition_broadcast
#define janus_condition_broadcast |
( |
|
a | ) |
g_cond_broadcast(a); |
Janus condition broadcast.
◆ janus_condition_destroy
#define janus_condition_destroy |
( |
|
a | ) |
g_cond_clear(a) |
Janus condition destruction.
◆ janus_condition_init
#define janus_condition_init |
( |
|
a | ) |
g_cond_init(a) |
Janus condition initialization.
◆ janus_condition_signal
#define janus_condition_signal |
( |
|
a | ) |
g_cond_signal(a); |
◆ janus_condition_wait
#define janus_condition_wait |
( |
|
a, |
|
|
|
b |
|
) |
| g_cond_wait(a, b); |
◆ janus_condition_wait_until
#define janus_condition_wait_until |
( |
|
a, |
|
|
|
b, |
|
|
|
c |
|
) |
| g_cond_wait_until(a, b, c); |
Janus condition wait until.
◆ janus_mutex_destroy
#define janus_mutex_destroy |
( |
|
a | ) |
g_mutex_clear(a) |
◆ janus_mutex_init
#define janus_mutex_init |
( |
|
a | ) |
g_mutex_init(a) |
Janus mutex initialization.
◆ JANUS_MUTEX_INITIALIZER
#define JANUS_MUTEX_INITIALIZER {0} |
Janus static mutex initializer.
◆ janus_mutex_lock
Janus mutex lock wrapper (selective locking debug)
◆ janus_mutex_lock_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)
◆ janus_mutex_lock_nodebug
#define janus_mutex_lock_nodebug |
( |
|
a | ) |
g_mutex_lock(a); |
Janus mutex lock without debug.
◆ janus_mutex_unlock
Janus mutex unlock wrapper (selective locking debug)
◆ janus_mutex_unlock_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)
◆ janus_mutex_unlock_nodebug
#define janus_mutex_unlock_nodebug |
( |
|
a | ) |
g_mutex_unlock(a); |
Janus mutex unlock without debug.
◆ janus_condition
Janus condition implementation.
◆ janus_mutex
Janus mutex implementation.
◆ lock_debug