kernel/locks: Assert that rwlocks have no readers on destruction.

Previously only whether there were active waiters was checked.
This commit is contained in:
Augustin Cavalier
2024-09-10 23:02:18 -04:00
parent 2d07400f07
commit 70b84c8aa2
+3 -3
View File
@@ -421,9 +421,9 @@ rw_lock_destroy(rw_lock* lock)
InterruptsSpinLocker locker(lock->lock); InterruptsSpinLocker locker(lock->lock);
#if KDEBUG #if KDEBUG
if (lock->waiters != NULL && thread_get_current_thread_id() if ((atomic_get(&lock->count) != 0 || lock->waiters != NULL)
!= lock->holder) { && thread_get_current_thread_id() != lock->holder) {
panic("rw_lock_destroy(): there are blocking threads, but the caller " panic("rw_lock_destroy(): lock is in use and the caller "
"doesn't hold the write lock (%p)", lock); "doesn't hold the write lock (%p)", lock);
locker.Unlock(); locker.Unlock();