mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 09:18:05 +03:00
fbb31b4519
There are a few violations with signal handling that I won't be able to fix it until later this week. So lets put lock rank enforcement under a debug option for now so other folks don't hit these crashes until rank enforcement is more fleshed out.
34 lines
788 B
C++
34 lines
788 B
C++
/*
|
|
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Locking/LockRank.h>
|
|
#include <Kernel/Thread.h>
|
|
|
|
// Note: These stubs can't be in LockRank.h as that would create
|
|
// a cyclic dependency in the header include graph of the Kernel.
|
|
|
|
namespace Kernel {
|
|
|
|
void track_lock_acquire(LockRank rank)
|
|
{
|
|
if constexpr (LOCK_RANK_ENFORCEMENT) {
|
|
auto thread = Thread::current();
|
|
if (thread && !thread->is_crashing())
|
|
thread->track_lock_acquire(rank);
|
|
}
|
|
}
|
|
|
|
void track_lock_release(LockRank rank)
|
|
{
|
|
if constexpr (LOCK_RANK_ENFORCEMENT) {
|
|
auto thread = Thread::current();
|
|
if (thread && !thread->is_crashing())
|
|
thread->track_lock_release(rank);
|
|
}
|
|
}
|
|
|
|
}
|