Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/bind9/isc
File: mutex.h
/*
[0] Fix | Delete
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
[11] Fix | Delete
#ifndef ISC_MUTEX_H
[12] Fix | Delete
#define ISC_MUTEX_H 1
[13] Fix | Delete
[14] Fix | Delete
/*! \file */
[15] Fix | Delete
[16] Fix | Delete
#include <pthread.h>
[17] Fix | Delete
#include <stdio.h>
[18] Fix | Delete
[19] Fix | Delete
#include <isc/lang.h>
[20] Fix | Delete
#include <isc/result.h> /* for ISC_R_ codes */
[21] Fix | Delete
[22] Fix | Delete
ISC_LANG_BEGINDECLS
[23] Fix | Delete
[24] Fix | Delete
/*!
[25] Fix | Delete
* Supply mutex attributes that enable deadlock detection
[26] Fix | Delete
* (helpful when debugging). This is system dependent and
[27] Fix | Delete
* currently only supported on NetBSD.
[28] Fix | Delete
*/
[29] Fix | Delete
#if ISC_MUTEX_DEBUG && defined(__NetBSD__) && defined(PTHREAD_MUTEX_ERRORCHECK)
[30] Fix | Delete
extern pthread_mutexattr_t isc__mutex_attrs;
[31] Fix | Delete
#define ISC__MUTEX_ATTRS &isc__mutex_attrs
[32] Fix | Delete
#else
[33] Fix | Delete
#define ISC__MUTEX_ATTRS NULL
[34] Fix | Delete
#endif
[35] Fix | Delete
[36] Fix | Delete
/* XXX We could do fancier error handling... */
[37] Fix | Delete
[38] Fix | Delete
/*!
[39] Fix | Delete
* Define ISC_MUTEX_PROFILE to turn on profiling of mutexes by line. When
[40] Fix | Delete
* enabled, isc_mutex_stats() can be used to print a table showing the
[41] Fix | Delete
* number of times each type of mutex was locked and the amount of time
[42] Fix | Delete
* waiting to obtain the lock.
[43] Fix | Delete
*/
[44] Fix | Delete
#ifndef ISC_MUTEX_PROFILE
[45] Fix | Delete
#define ISC_MUTEX_PROFILE 0
[46] Fix | Delete
#endif
[47] Fix | Delete
[48] Fix | Delete
#if ISC_MUTEX_PROFILE
[49] Fix | Delete
typedef struct isc_mutexstats isc_mutexstats_t;
[50] Fix | Delete
[51] Fix | Delete
typedef struct {
[52] Fix | Delete
pthread_mutex_t mutex; /*%< The actual mutex. */
[53] Fix | Delete
isc_mutexstats_t * stats; /*%< Mutex statistics. */
[54] Fix | Delete
} isc_mutex_t;
[55] Fix | Delete
#else
[56] Fix | Delete
typedef pthread_mutex_t isc_mutex_t;
[57] Fix | Delete
#endif
[58] Fix | Delete
[59] Fix | Delete
[60] Fix | Delete
#if ISC_MUTEX_PROFILE
[61] Fix | Delete
#define isc_mutex_init(mp) \
[62] Fix | Delete
isc_mutex_init_profile((mp), __FILE__, __LINE__)
[63] Fix | Delete
#else
[64] Fix | Delete
#if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)
[65] Fix | Delete
#define isc_mutex_init(mp) \
[66] Fix | Delete
isc_mutex_init_errcheck((mp))
[67] Fix | Delete
#else
[68] Fix | Delete
#define isc_mutex_init(mp) \
[69] Fix | Delete
isc__mutex_init((mp), __FILE__, __LINE__)
[70] Fix | Delete
isc_result_t isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line);
[71] Fix | Delete
#endif
[72] Fix | Delete
#endif
[73] Fix | Delete
[74] Fix | Delete
#if ISC_MUTEX_PROFILE
[75] Fix | Delete
#define isc_mutex_lock(mp) \
[76] Fix | Delete
isc_mutex_lock_profile((mp), __FILE__, __LINE__)
[77] Fix | Delete
#else
[78] Fix | Delete
#define isc_mutex_lock(mp) \
[79] Fix | Delete
((pthread_mutex_lock((mp)) == 0) ? \
[80] Fix | Delete
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
[81] Fix | Delete
#endif
[82] Fix | Delete
[83] Fix | Delete
#if ISC_MUTEX_PROFILE
[84] Fix | Delete
#define isc_mutex_unlock(mp) \
[85] Fix | Delete
isc_mutex_unlock_profile((mp), __FILE__, __LINE__)
[86] Fix | Delete
#else
[87] Fix | Delete
#define isc_mutex_unlock(mp) \
[88] Fix | Delete
((pthread_mutex_unlock((mp)) == 0) ? \
[89] Fix | Delete
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
[90] Fix | Delete
#endif
[91] Fix | Delete
[92] Fix | Delete
#if ISC_MUTEX_PROFILE
[93] Fix | Delete
#define isc_mutex_trylock(mp) \
[94] Fix | Delete
((pthread_mutex_trylock((&(mp)->mutex)) == 0) ? \
[95] Fix | Delete
ISC_R_SUCCESS : ISC_R_LOCKBUSY)
[96] Fix | Delete
#else
[97] Fix | Delete
#define isc_mutex_trylock(mp) \
[98] Fix | Delete
((pthread_mutex_trylock((mp)) == 0) ? \
[99] Fix | Delete
ISC_R_SUCCESS : ISC_R_LOCKBUSY)
[100] Fix | Delete
#endif
[101] Fix | Delete
[102] Fix | Delete
#if ISC_MUTEX_PROFILE
[103] Fix | Delete
#define isc_mutex_destroy(mp) \
[104] Fix | Delete
((pthread_mutex_destroy((&(mp)->mutex)) == 0) ? \
[105] Fix | Delete
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
[106] Fix | Delete
#else
[107] Fix | Delete
#define isc_mutex_destroy(mp) \
[108] Fix | Delete
((pthread_mutex_destroy((mp)) == 0) ? \
[109] Fix | Delete
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
[110] Fix | Delete
#endif
[111] Fix | Delete
[112] Fix | Delete
#if ISC_MUTEX_PROFILE
[113] Fix | Delete
#define isc_mutex_stats(fp) isc_mutex_statsprofile(fp);
[114] Fix | Delete
#else
[115] Fix | Delete
#define isc_mutex_stats(fp)
[116] Fix | Delete
#endif
[117] Fix | Delete
[118] Fix | Delete
#if ISC_MUTEX_PROFILE
[119] Fix | Delete
[120] Fix | Delete
isc_result_t
[121] Fix | Delete
isc_mutex_init_profile(isc_mutex_t *mp, const char * _file, int _line);
[122] Fix | Delete
isc_result_t
[123] Fix | Delete
isc_mutex_lock_profile(isc_mutex_t *mp, const char * _file, int _line);
[124] Fix | Delete
isc_result_t
[125] Fix | Delete
isc_mutex_unlock_profile(isc_mutex_t *mp, const char * _file, int _line);
[126] Fix | Delete
[127] Fix | Delete
void
[128] Fix | Delete
isc_mutex_statsprofile(FILE *fp);
[129] Fix | Delete
#endif /* ISC_MUTEX_PROFILE */
[130] Fix | Delete
[131] Fix | Delete
isc_result_t
[132] Fix | Delete
isc_mutex_init_errcheck(isc_mutex_t *mp);
[133] Fix | Delete
[134] Fix | Delete
ISC_LANG_ENDDECLS
[135] Fix | Delete
#endif /* ISC_MUTEX_H */
[136] Fix | Delete
[137] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function