2020-02-24 21:04:12 -05:00
|
|
|
// Copyright 2020 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-25 21:16:40 -04:00
|
|
|
#include <atomic>
|
2020-02-24 21:04:12 -05: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 15:37:02 -05:00
|
|
|
CPUInterruptHandler(CPUInterruptHandler&&) = delete;
|
|
|
|
CPUInterruptHandler& operator=(CPUInterruptHandler&&) = delete;
|
2020-02-24 21:04:12 -05:00
|
|
|
|
2020-06-27 18:20:06 -04:00
|
|
|
bool IsInterrupted() const {
|
2020-02-24 21:04:12 -05:00
|
|
|
return is_interrupted;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetInterrupt(bool is_interrupted);
|
|
|
|
|
|
|
|
void AwaitInterrupt();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Common::Event> interrupt_event;
|
2020-08-25 21:19:01 -04:00
|
|
|
std::atomic_bool is_interrupted{false};
|
2020-02-24 21:04:12 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|