summaryrefslogtreecommitdiff
path: root/Kernel/Arch/ScopedCritical.h
blob: 678069e4f6f9d067587b07607d7dbeb04d170d8c (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
/*
 * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Noncopyable.h>

namespace Kernel {

class ScopedCritical {
    AK_MAKE_NONCOPYABLE(ScopedCritical);

public:
    ScopedCritical();
    ~ScopedCritical();
    ScopedCritical(ScopedCritical&& from);

    ScopedCritical& operator=(ScopedCritical&& from);

    void leave();
    void enter();

private:
    bool m_valid { false };
};

}