diff options
Diffstat (limited to 'usr.sbin/bind/lib/isc/pthreads/mutex.c')
-rw-r--r-- | usr.sbin/bind/lib/isc/pthreads/mutex.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/usr.sbin/bind/lib/isc/pthreads/mutex.c b/usr.sbin/bind/lib/isc/pthreads/mutex.c index 232d26f2ab1..9bbbfb898eb 100644 --- a/usr.sbin/bind/lib/isc/pthreads/mutex.c +++ b/usr.sbin/bind/lib/isc/pthreads/mutex.c @@ -1,21 +1,21 @@ /* - * Copyright (C) 2000, 2001 Internet Software Consortium. + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: mutex.c,v 1.6 2001/01/09 21:58:01 bwelling Exp $ */ +/* $ISC: mutex.c,v 1.6.26.3 2004/03/08 09:04:55 marka 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 */ |