#include <pthread.h>
#include <stdio.h>
#include <isc/lang.h>
#include <isc/result.h>
Go to the source code of this file.
Defines | |
#define | ISC_MUTEX_H 1 |
#define | ISC__MUTEX_ATTRS NULL |
#define | ISC_MUTEX_PROFILE 0 |
#define | isc_mutex_init(mp) isc__mutex_init((mp), __FILE__, __LINE__) |
#define | isc_mutex_lock(mp) |
#define | isc_mutex_unlock(mp) |
#define | isc_mutex_trylock(mp) |
#define | isc_mutex_destroy(mp) |
#define | isc_mutex_stats(fp) |
Typedefs | |
typedef pthread_mutex_t | isc_mutex_t |
Functions | |
isc_result_t | isc__mutex_init (isc_mutex_t *mp, const char *file, unsigned int line) |
Definition in file mutex.h.
#define ISC__MUTEX_ATTRS NULL |
Supply mutex attributes that enable deadlock detection (helpful when debugging). This is system dependent and currently only supported on NetBSD.
Definition at line 42 of file mutex.h.
Referenced by isc__mutex_init().
#define ISC_MUTEX_PROFILE 0 |
Define ISC_MUTEX_PROFILE to turn on profiling of mutexes by line. When enabled, isc_mutex_stats() can be used to print a table showing the number of times each type of mutex was locked and the amount of time waiting to obtain the lock.
#define isc_mutex_init | ( | mp | ) | isc__mutex_init((mp), __FILE__, __LINE__) |
#define isc_mutex_lock | ( | mp | ) |
Value:
((pthread_mutex_lock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED)
#define isc_mutex_unlock | ( | mp | ) |
Value:
((pthread_mutex_unlock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED)
#define isc_mutex_trylock | ( | mp | ) |
Value:
((pthread_mutex_trylock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_LOCKBUSY)
#define isc_mutex_destroy | ( | mp | ) |
Value:
((pthread_mutex_destroy((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED)
typedef pthread_mutex_t isc_mutex_t |
isc_result_t isc__mutex_init | ( | isc_mutex_t * | mp, | |
const char * | file, | |||
unsigned int | line | |||
) |
Definition at line 280 of file mutex.c.
References ISC__MUTEX_ATTRS, isc__strerror(), isc_once_do, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_STRERRORSIZE, RUNTIME_CHECK, and UNEXPECTED_ERROR.