Loading...
Searching...
No Matches
Macros | Typedefs | Variables
mutex.h File Reference

Semaphores, Mutexes and Conditions. More...

#include "../imquic/debug.h"
Include dependency graph for mutex.h:
This graph shows which files directly or indirectly include this file:

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
 

Detailed Description

Semaphores, 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) of a locking mechanism based on mutexes and conditions.

Macro Definition Documentation

◆ imquic_condition_broadcast

#define imquic_condition_broadcast ( a)    g_cond_broadcast(a);

imquic condition broadcast

◆ imquic_condition_destroy

#define imquic_condition_destroy ( a)    g_cond_clear(a)

imquic condition destruction

◆ imquic_condition_init

#define imquic_condition_init ( a)    g_cond_init(a)

imquic condition initialization

◆ imquic_condition_signal

#define imquic_condition_signal ( a)    g_cond_signal(a);

imquic condition signal

◆ imquic_condition_wait

#define imquic_condition_wait ( a,
b )   g_cond_wait(a, b);

imquic condition wait

◆ imquic_condition_wait_until

#define imquic_condition_wait_until ( a,
b,
c )   g_cond_wait_until(a, b, c);

imquic condition wait until

◆ imquic_mutex_destroy

#define imquic_mutex_destroy ( a)    g_mutex_clear(a)

imquic mutex destruction

◆ imquic_mutex_init

#define imquic_mutex_init ( a)    g_mutex_init(a)

imquic mutex initialization

◆ IMQUIC_MUTEX_INITIALIZER

#define IMQUIC_MUTEX_INITIALIZER   {0}

imquic static mutex initializer

◆ imquic_mutex_lock

#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)

◆ imquic_mutex_lock_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)

◆ imquic_mutex_lock_nodebug

#define imquic_mutex_lock_nodebug ( a)    g_mutex_lock(a)

imquic mutex lock without debug

◆ imquic_mutex_trylock

#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)

◆ imquic_mutex_trylock_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)

◆ imquic_mutex_trylock_nodebug

#define imquic_mutex_trylock_nodebug ( a)    { ret = g_mutex_trylock(a); }

imquic mutex try lock without debug

◆ imquic_mutex_unlock

#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)

◆ imquic_mutex_unlock_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)

◆ imquic_mutex_unlock_nodebug

#define imquic_mutex_unlock_nodebug ( a)    g_mutex_unlock(a)

imquic mutex unlock without debug

Typedef Documentation

◆ imquic_condition

typedef GCond imquic_condition

imquic condition implementation

◆ imquic_mutex

typedef GMutex imquic_mutex

imquic mutex implementation

Variable Documentation

◆ imquic_lock_debug

gboolean imquic_lock_debug
extern