kernel/locks: Assert in rw_lock_wait that we weren't spuriously unblocked.
May have caught #19458 earlier, depending on cause. Change-Id: Ib5dd4ef72474f944946e1dae214c49fe440669bc Reviewed-on: https://review.haiku-os.org/c/haiku/+/9086 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
0958031b24
commit
b3d011b90a
@@ -320,6 +320,7 @@ rw_lock_wait(rw_lock* lock, bool writer, InterruptsSpinLocker& locker)
|
||||
status_t result = thread_block();
|
||||
|
||||
locker.Lock();
|
||||
ASSERT(result != B_OK || waiter.thread == NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -347,8 +348,8 @@ rw_lock_unblock(rw_lock* lock)
|
||||
|
||||
// unblock thread
|
||||
thread_unblock(waiter->thread, B_OK);
|
||||
|
||||
waiter->thread = NULL;
|
||||
|
||||
return RW_LOCK_WRITER_COUNT_BASE;
|
||||
}
|
||||
|
||||
@@ -364,7 +365,6 @@ rw_lock_unblock(rw_lock* lock)
|
||||
|
||||
// unblock thread
|
||||
thread_unblock(waiter->thread, B_OK);
|
||||
|
||||
waiter->thread = NULL;
|
||||
} while ((waiter = lock->waiters) != NULL && !waiter->writer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user