mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Kernel: Verify mutex big lock behavior
These two methods are big lock specific, so verify our mutex' behavior.
This commit is contained in:
parent
bb02e9a7b9
commit
14fc05e912
Notes:
sideshowbarker
2024-07-17 14:14:37 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/14fc05e912 Pull-request: https://github.com/SerenityOS/serenity/pull/13587 Reviewed-by: https://github.com/IdanHo
1 changed files with 4 additions and 0 deletions
|
@ -282,9 +282,11 @@ void Mutex::unblock_waiters(Mode previous_mode)
|
|||
|
||||
auto Mutex::force_unlock_exclusive_if_locked(u32& lock_count_to_restore) -> Mode
|
||||
{
|
||||
VERIFY(m_behavior == MutexBehavior::BigLock);
|
||||
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
|
||||
// and also from within critical sections!
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
|
||||
auto* current_thread = Thread::current();
|
||||
SpinlockLocker lock(m_lock);
|
||||
auto current_mode = m_mode;
|
||||
|
@ -319,8 +321,10 @@ auto Mutex::force_unlock_exclusive_if_locked(u32& lock_count_to_restore) -> Mode
|
|||
|
||||
void Mutex::restore_exclusive_lock(u32 lock_count, [[maybe_unused]] LockLocation const& location)
|
||||
{
|
||||
VERIFY(m_behavior == MutexBehavior::BigLock);
|
||||
VERIFY(lock_count > 0);
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
|
||||
auto* current_thread = Thread::current();
|
||||
bool did_block = false;
|
||||
SpinlockLocker lock(m_lock);
|
||||
|
|
Loading…
Reference in a new issue