summaryrefslogblamecommitdiffstats
path: root/src/core/arm/cpu_interrupt_handler.h
blob: 286e12e53afe12cf547a8ba2d5480bd6d68e38f6 (plain) (tree)
1
2
3
4
5
6

                                                               


            
                 















                                                                        

                                                                   
 
                                







                                           
                                                   
                                           


                   
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#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&&) = delete;
    CPUInterruptHandler& operator=(CPUInterruptHandler&&) = delete;

    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