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.
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);
}