summaryrefslogtreecommitdiff
path: root/Kernel/Locking/LockRank.cpp
blob: 0bc5e8d68c1b7d838290035b34b0ee3457ef8c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * 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);
    }
}

}