diff --git a/lib/isc/pthreads/include/isc/condition.h b/lib/isc/pthreads/include/isc/condition.h index 28338c7fdf..92d33ad324 100644 --- a/lib/isc/pthreads/include/isc/condition.h +++ b/lib/isc/pthreads/include/isc/condition.h @@ -23,8 +23,8 @@ typedef pthread_cond_t isc_condition_t; #define isc_condition_init(cp) \ - ((pthread_cond_init((cp), NULL) == 0) ? \ - ISC_R_SUCCESS : ISC_R_UNEXPECTED) + (RUNTIME_CHECK(pthread_cond_init((cp), NULL) == 0), \ + ISC_R_SUCCESS) #if ISC_MUTEX_PROFILE #define isc_condition_wait(cp, mp) \ diff --git a/lib/isc/pthreads/mutex.c b/lib/isc/pthreads/mutex.c index 76bac089b6..b290b50fe0 100644 --- a/lib/isc/pthreads/mutex.c +++ b/lib/isc/pthreads/mutex.c @@ -88,10 +88,10 @@ isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) { int i, err; err = pthread_mutex_init(&mp->mutex, NULL); - if (err == ENOMEM) - return (ISC_R_NOMEMORY); - if (err != 0) - return (ISC_R_UNEXPECTED); + if (err != 0) { + strerror_r(err, strbuf, sizeof(strbuf)); + isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf); + } RUNTIME_CHECK(pthread_mutex_lock(&statslock) == 0); @@ -294,9 +294,7 @@ isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) { return (ISC_R_NOMEMORY); if (err != 0) { strerror_r(err, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(file, line, "isc_mutex_init() failed: %s", - strbuf); - result = ISC_R_UNEXPECTED; + isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf); } return (result); }