mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Print lock tracing to stderr.
Decrement granted read lock when releasing a read lock if there are no pending write locks. This still allows fair queuing between read and write locks but does not block on aquiring a new read relock if we are below quota of active locks and there are no pending writes.
This commit is contained in:
parent
3ddd814a97
commit
202e42a230
@ -32,14 +32,12 @@
|
|||||||
#ifdef ISC_RWLOCK_TRACE
|
#ifdef ISC_RWLOCK_TRACE
|
||||||
static void
|
static void
|
||||||
print_lock(char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
print_lock(char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||||
printf("%s(%s): ", operation,
|
fprintf(stderr,
|
||||||
(type == isc_rwlocktype_read ? "read" : "write"));
|
"%s(%s): %s, %u active, %u granted, %u rwaiting, %u wwaiting\n",
|
||||||
printf("%s, %u active, %u granted",
|
operation, (type == isc_rwlocktype_read ? "read" : "write"),
|
||||||
(rwl->type == isc_rwlocktype_read ? "reading" : "writing"),
|
(rwl->type == isc_rwlocktype_read ? "reading" : "writing"),
|
||||||
rwl->active, rwl->granted);
|
rwl->active, rwl->granted, rwl->readers_waiting,
|
||||||
printf(", %u rwaiting, %u wwaiting\n",
|
rwl->writers_waiting);
|
||||||
rwl->readers_waiting,
|
|
||||||
rwl->writers_waiting);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -196,11 +194,11 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rwl->type == isc_rwlocktype_read &&
|
if (rwl->type == isc_rwlocktype_read &&
|
||||||
rwl->writers_waiting == 0 &&
|
rwl->writers_waiting == 0) {
|
||||||
rwl->readers_waiting > 0) {
|
|
||||||
INSIST(rwl->granted > 0);
|
INSIST(rwl->granted > 0);
|
||||||
rwl->granted--;
|
rwl->granted--;
|
||||||
SIGNAL(&rwl->readable);
|
if (rwl->readers_waiting > 0)
|
||||||
|
SIGNAL(&rwl->readable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user