mutex.h File Reference

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


Detailed Description

Definition in file mutex.h.


Define Documentation

#define ISC_MUTEX_H   1

Definition at line 21 of 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.

Definition at line 54 of file mutex.h.

#define isc_mutex_init ( mp   )     isc__mutex_init((mp), __FILE__, __LINE__)

Definition at line 77 of file mutex.h.

#define isc_mutex_lock ( mp   ) 

Value:

((pthread_mutex_lock((mp)) == 0) ? \
         ISC_R_SUCCESS : ISC_R_UNEXPECTED)

Definition at line 87 of file mutex.h.

#define isc_mutex_unlock ( mp   ) 

Value:

((pthread_mutex_unlock((mp)) == 0) ? \
         ISC_R_SUCCESS : ISC_R_UNEXPECTED)

Definition at line 96 of file mutex.h.

#define isc_mutex_trylock ( mp   ) 

Value:

((pthread_mutex_trylock((mp)) == 0) ? \
         ISC_R_SUCCESS : ISC_R_LOCKBUSY)

Definition at line 106 of file mutex.h.

#define isc_mutex_destroy ( mp   ) 

Value:

((pthread_mutex_destroy((mp)) == 0) ? \
         ISC_R_SUCCESS : ISC_R_UNEXPECTED)

Definition at line 116 of file mutex.h.

#define isc_mutex_stats ( fp   ) 

Definition at line 124 of file mutex.h.


Typedef Documentation

typedef pthread_mutex_t isc_mutex_t

Definition at line 65 of file mutex.h.


Function Documentation

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.


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha