Loading...
Searching...
No Matches
mutex.h File Reference
Core

Semaphors, Mutexes and Conditions. More...

`#include <pthread.h>`
`#include <errno.h>`
`#include "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 | janus_mutex_init(a)
| Janus mutex initialization.
#define | JANUS_MUTEX_INITIALIZER {0}
| Janus static mutex initializer.
#define | janus_mutex_destroy(a)
| Janus mutex destruction.
#define | janus_mutex_lock_nodebug(a)
| Janus mutex lock without debug.
#define | janus_mutex_lock_debug(a)
| Janus mutex lock with debug (prints the line that locked a mutex).
#define | janus_mutex_lock(a)
| Janus mutex lock wrapper (selective locking debug).
#define | janus_mutex_trylock_nodebug(a)
| Janus mutex try lock without debug.
#define | janus_mutex_trylock_debug(a)
| Janus mutex try lock with debug (prints the line that tried to lock a mutex).
#define | janus_mutex_trylock(a)
| Janus mutex try lock wrapper (selective locking debug).
#define | janus_mutex_unlock_nodebug(a)
| Janus mutex unlock without debug.
#define | janus_mutex_unlock_debug(a)
| Janus mutex unlock with debug (prints the line that unlocked a mutex).
#define | janus_mutex_unlock(a)
| Janus mutex unlock wrapper (selective locking debug).
#define | janus_condition_init(a)
| Janus condition initialization.
#define | janus_condition_destroy(a)
| Janus condition destruction.
#define | janus_condition_wait(a, b)
| Janus condition wait.
#define | janus_condition_wait_until(a, b, c)
| Janus condition wait until.
#define | janus_condition_signal(a)
| Janus condition signal.
#define | janus_condition_broadcast(a)
| Janus condition broadcast.

## Typedefs

typedef GMutex | janus_mutex
| Janus mutex implementation.
typedef GCond | janus_condition
| Janus condition implementation.

## Variables

int | lock_debug

## Detailed Description

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

## Macro Definition Documentation

## janus_condition_broadcast

#define janus_condition_broadcast | ( |  | a | ) |

Value:
g_cond_broadcast(a);

Janus condition broadcast.

## janus_condition_destroy

#define janus_condition_destroy | ( |  | a | ) |

Value:
g_cond_clear(a)

Janus condition destruction.

## janus_condition_init

#define janus_condition_init | ( |  | a | ) |

Value:
g_cond_init(a)

Janus condition initialization.

## janus_condition_signal

#define janus_condition_signal | ( |  | a | ) |

Value:
g_cond_signal(a);

Janus condition signal.

## janus_condition_wait

#define janus_condition_wait | ( |  | a,
|  |  | b )

Value:
g_cond_wait(a, b);

Janus condition wait.

## janus_condition_wait_until

#define janus_condition_wait_until | ( |  | a,
|  |  | b,
|  |  | c )

Value:
g_cond_wait_until(a, b, c);

Janus condition wait until.

## janus_mutex_destroy

#define janus_mutex_destroy | ( |  | a | ) |

Value:
g_mutex_clear(a)

Janus mutex destruction.

## janus_mutex_init

#define janus_mutex_init | ( |  | a | ) |

Value:
g_mutex_init(a)

Janus mutex initialization.

## JANUS_MUTEX_INITIALIZER

#define JANUS_MUTEX_INITIALIZER {0}

Janus static mutex initializer.

## janus_mutex_lock

#define janus_mutex_lock | ( |  | a | ) |

Value:
{ if(!lock_debug) { janus_mutex_lock_nodebug(a); } else { janus_mutex_lock_debug(a); } }
lock_debug
int lock_debug
Definition janus-cfgconv.c:38
janus_mutex_lock_debug
#define janus_mutex_lock_debug(a)
Janus mutex lock with debug (prints the line that locked a mutex).
Definition mutex.h:83
janus_mutex_lock_nodebug
#define janus_mutex_lock_nodebug(a)
Janus mutex lock without debug.
Definition mutex.h:81

Janus mutex lock wrapper (selective locking debug).

## janus_mutex_lock_debug

#define janus_mutex_lock_debug | ( |  | a | ) |

Value:
{ JANUS_PRINT("[%s:%s:%d:lock] %p\n", __FILE__, __FUNCTION__, __LINE__, a); g_mutex_lock(a); }
JANUS_PRINT
#define JANUS_PRINT
Simple wrapper to g_print/printf.
Definition debug.h:87

Janus mutex lock with debug (prints the line that locked a mutex).

## janus_mutex_lock_nodebug

#define janus_mutex_lock_nodebug | ( |  | a | ) |

Value:
g_mutex_lock(a)

Janus mutex lock without debug.

## janus_mutex_trylock

#define janus_mutex_trylock | ( |  | a | ) |

Value:
({ gboolean ret; if(!lock_debug) { janus_mutex_trylock_nodebug(a); } else { janus_mutex_trylock_debug(a); } ret; })
janus_mutex_trylock_nodebug
#define janus_mutex_trylock_nodebug(a)
Janus mutex try lock without debug.
Definition mutex.h:87
janus_mutex_trylock_debug
#define janus_mutex_trylock_debug(a)
Janus mutex try lock with debug (prints the line that tried to lock a mutex).
Definition mutex.h:89

Janus mutex try lock wrapper (selective locking debug).

## janus_mutex_trylock_debug

#define janus_mutex_trylock_debug | ( |  | a | ) |

Value:
{ 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).

## janus_mutex_trylock_nodebug

#define janus_mutex_trylock_nodebug | ( |  | a | ) |

Value:
{ ret = g_mutex_trylock(a); }

Janus mutex try lock without debug.

## janus_mutex_unlock

#define janus_mutex_unlock | ( |  | a | ) |

Value:
{ if(!lock_debug) { janus_mutex_unlock_nodebug(a); } else { janus_mutex_unlock_debug(a); } }
janus_mutex_unlock_nodebug
#define janus_mutex_unlock_nodebug(a)
Janus mutex unlock without debug.
Definition mutex.h:93
janus_mutex_unlock_debug
#define janus_mutex_unlock_debug(a)
Janus mutex unlock with debug (prints the line that unlocked a mutex).
Definition mutex.h:95

Janus mutex unlock wrapper (selective locking debug).

## janus_mutex_unlock_debug

#define janus_mutex_unlock_debug | ( |  | a | ) |

Value:
{ 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 | ) |

Value:
g_mutex_unlock(a)

Janus mutex unlock without debug.

## Typedef Documentation

## janus_condition

typedef GCond janus_condition

Janus condition implementation.

## janus_mutex

typedef GMutex janus_mutex

Janus mutex implementation.

## Variable Documentation

## lock_debug

int lock_debug

extern