mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-24 15:13:57 +00:00
Kernel: Make Lock::lock() assert early that we're not in the scheduler
The scheduler is not allowed to take locks, so if that's happening, we want to make that clear instead of crashing with the more general "Interrupts disabled while trying to take Lock" error.
This commit is contained in:
parent
bb74832dd6
commit
933a98f8fa
Notes:
sideshowbarker
2024-07-19 12:34:10 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/933a98f8fac
1 changed files with 1 additions and 1 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
void Lock::lock()
|
||||
{
|
||||
ASSERT(!Scheduler::is_active());
|
||||
if (!are_interrupts_enabled()) {
|
||||
kprintf("Interrupts disabled when trying to take Lock{%s}\n", m_name);
|
||||
dump_backtrace();
|
||||
hang();
|
||||
}
|
||||
ASSERT(!Scheduler::is_active());
|
||||
for (;;) {
|
||||
if (CAS(&m_lock, 1, 0) == 0) {
|
||||
if (!m_holder || m_holder == current) {
|
||||
|
|
Loading…
Reference in a new issue