mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00: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:
@@ -35,9 +35,13 @@
|
|||||||
void
|
void
|
||||||
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
|
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
|
||||||
unsigned int write_quota) {
|
unsigned int write_quota) {
|
||||||
|
int ret;
|
||||||
UNUSED(read_quota);
|
UNUSED(read_quota);
|
||||||
UNUSED(write_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);
|
atomic_init(&rwl->downgrade, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user