2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-02-25 03:04:12 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-26 03:16:40 +02:00
|
|
|
#include <atomic>
|
2020-02-25 03:04:12 +01:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class Event;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class CPUInterruptHandler {
|
|
|
|
public:
|
|
|
|
CPUInterruptHandler();
|
|
|
|
~CPUInterruptHandler();
|
|
|
|
|
|
|
|
CPUInterruptHandler(const CPUInterruptHandler&) = delete;
|
|
|
|
CPUInterruptHandler& operator=(const CPUInterruptHandler&) = delete;
|
|
|
|
|
2020-11-08 21:37:02 +01:00
|
|
|
CPUInterruptHandler(CPUInterruptHandler&&) = delete;
|
|
|
|
CPUInterruptHandler& operator=(CPUInterruptHandler&&) = delete;
|
2020-02-25 03:04:12 +01:00
|
|
|
|
2020-06-28 00:20:06 +02:00
|
|
|
bool IsInterrupted() const {
|
2020-02-25 03:04:12 +01:00
|
|
|
return is_interrupted;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetInterrupt(bool is_interrupted);
|
|
|
|
|
|
|
|
void AwaitInterrupt();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Common::Event> interrupt_event;
|
2020-08-26 03:19:01 +02:00
|
|
|
std::atomic_bool is_interrupted{false};
|
2020-02-25 03:04:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|