mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-15 22:09:31 -04:00
isc_mutex_init and isc_condition_init failures are now fatal
This commit is contained in:
parent
ac4f8a51cc
commit
0bed9bfc28
2 changed files with 7 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue