mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 15:09:59 -04:00
Handle pthread_*_init() failures consistently
isc_rwlock_init() currently detects pthread_rwlock_init() failures using a REQUIRE() assertion. Use the ERRNO_CHECK() macro for that purpose instead, so that read-write lock initialization failures are handled identically as condition variable (pthread_cond_init()) and mutex (pthread_mutex_init()) initialization failures.
This commit is contained in:
parent
365b47caee
commit
5759ace07f
1 changed files with 5 additions and 1 deletions
|
|
@ -35,9 +35,13 @@
|
|||
void
|
||||
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
|
||||
unsigned int write_quota) {
|
||||
int ret;
|
||||
UNUSED(read_quota);
|
||||
UNUSED(write_quota);
|
||||
REQUIRE(pthread_rwlock_init(&rwl->rwlock, NULL) == 0);
|
||||
|
||||
ret = pthread_rwlock_init(&rwl->rwlock, NULL);
|
||||
ERRNO_CHECK(pthread_rwlock_init, ret);
|
||||
|
||||
atomic_init(&rwl->downgrade, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue