summaryrefslogtreecommitdiffstats
path: root/src/core/arm/cpu_interrupt_handler.h
blob: 71e582f7975d8af5038260e64fc092c8b1fafa13 (plain) (blame)
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
34
35
36
37
38
39
40
// Copyright 2020 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <atomic>
#include <memory>

namespace Common {
class Event;
}

namespace Core {

class CPUInterruptHandler {
public:
    CPUInterruptHandler();
    ~CPUInterruptHandler();

    CPUInterruptHandler(const CPUInterruptHandler&) = delete;
    CPUInterruptHandler& operator=(const CPUInterruptHandler&) = delete;

    CPUInterruptHandler(CPUInterruptHandler&&) = default;
    CPUInterruptHandler& operator=(CPUInterruptHandler&&) = default;

    bool IsInterrupted() const {
        return is_interrupted;
    }

    void SetInterrupt(bool is_interrupted);

    void AwaitInterrupt();

private:
    std::unique_ptr<Common::Event> interrupt_event;
    std::atomic_bool is_interrupted{false};
};

} // namespace Core