mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-19 02:28:27 -05:00
Fix the isc_rwlock_tryupgrade() function's unit test
The pthread-based implementation of the isc_rwlock_tryupgrade()
function always returns ISC_R_LOCKBUSY. Fix the test by adding
conditional checks.
(cherry picked from commit c27659bc62)
This commit is contained in:
parent
005c23aba7
commit
b959ac44a7
1 changed files with 9 additions and 0 deletions
|
|
@ -137,8 +137,17 @@ ISC_RUN_TEST_IMPL(isc_rwlock_tryupgrade) {
|
|||
isc_result_t result;
|
||||
isc_rwlock_lock(&rwlock, isc_rwlocktype_read);
|
||||
result = isc_rwlock_tryupgrade(&rwlock);
|
||||
#if USE_PTHREAD_RWLOCK
|
||||
/*
|
||||
* Our pthread-based rwlock implementation does not support tryupgrade,
|
||||
* and always returns ISC_R_LOCKBUSY.
|
||||
*/
|
||||
assert_int_equal(result, ISC_R_LOCKBUSY);
|
||||
isc_rwlock_unlock(&rwlock, isc_rwlocktype_read);
|
||||
#else
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_rwlock_unlock(&rwlock, isc_rwlocktype_write);
|
||||
#endif /* USE_PTHREAD_RWLOCK */
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
|||
Loading…
Reference in a new issue