add goo for error checking mutexes on (at least) tru64
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: mutex.h,v 1.23 2001/01/09 21:58:07 bwelling Exp $ */
|
||||
/* $Id: mutex.h,v 1.24 2002/09/08 18:32:38 explorer Exp $ */
|
||||
|
||||
#ifndef ISC_MUTEX_H
|
||||
#define ISC_MUTEX_H 1
|
||||
@@ -65,10 +65,15 @@ typedef pthread_mutex_t isc_mutex_t;
|
||||
#define isc_mutex_init(mp) \
|
||||
isc_mutex_init_profile((mp), __FILE__, __LINE__)
|
||||
#else
|
||||
#if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)
|
||||
#define isc_mutex_init(mp) \
|
||||
isc_mutex_init_errcheck((mp))
|
||||
#else
|
||||
#define isc_mutex_init(mp) \
|
||||
((pthread_mutex_init((mp), ISC__MUTEX_ATTRS) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ISC_MUTEX_PROFILE
|
||||
#define isc_mutex_lock(mp) \
|
||||
@@ -126,6 +131,9 @@ isc_mutex_unlock_profile(isc_mutex_t *mp, const char * _file, int _line);
|
||||
void
|
||||
isc_mutex_statsprofile(FILE *fp);
|
||||
|
||||
isc_result_t
|
||||
isc_mutex_init_errcheck(isc_mutex_t *mp);
|
||||
|
||||
#endif /* ISC_MUTEX_PROFILE */
|
||||
|
||||
#endif /* ISC_MUTEX_H */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: mutex.c,v 1.6 2001/01/09 21:58:01 bwelling Exp $ */
|
||||
/* $Id: mutex.c,v 1.7 2002/09/08 18:32:38 explorer Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -214,6 +214,25 @@ isc_mutex_statsprofile(FILE *fp) {
|
||||
|
||||
#endif /* ISC_MUTEX_PROFILE */
|
||||
|
||||
#if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)
|
||||
isc_result_t
|
||||
isc_mutex_init_errcheck(isc_mutex_t *mp)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
if (pthread_mutexattr_init(&attr) != 0)
|
||||
return ISC_R_UNEXPECTED;
|
||||
|
||||
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0)
|
||||
return ISC_R_UNEXPECTED;
|
||||
|
||||
if (pthread_mutex_init(mp, &attr) != 0)
|
||||
return ISC_R_UNEXPECTED;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ISC_MUTEX_DEBUG && defined(__NetBSD__) && defined(PTHREAD_MUTEX_ERRORCHECK)
|
||||
pthread_mutexattr_t isc__mutex_attrs = {
|
||||
PTHREAD_MUTEX_ERRORCHECK, /* m_type */
|
||||
|
||||
Reference in New Issue
Block a user