Commit 0bed9bfc authored by Witold Krecicki's avatar Witold Krecicki
Browse files

isc_mutex_init and isc_condition_init failures are now fatal

parent ac4f8a51
......@@ -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) \
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment