yuzu/src/core/hle/kernel/readable_event.h

58 lines
1.3 KiB
C
Raw Normal View History

2020-12-28 19:15:37 +04:00
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
2020-12-31 14:03:11 +04:00
#include "core/hle/kernel/k_synchronization_object.h"
2020-12-28 19:15:37 +04:00
#include "core/hle/kernel/object.h"
union ResultCode;
namespace Kernel {
class KernelCore;
class WritableEvent;
2020-12-31 14:03:11 +04:00
class ReadableEvent final : public KSynchronizationObject {
2020-12-28 19:15:37 +04:00
friend class WritableEvent;
public:
~ReadableEvent() override;
std::string GetTypeName() const override {
return "ReadableEvent";
}
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::ReadableEvent;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
/// Unconditionally clears the readable event's state.
void Clear();
/// Clears the readable event's state if and only if it
/// has already been signaled.
///
/// @pre The event must be in a signaled state. If this event
/// is in an unsignaled state and this function is called,
/// then ERR_INVALID_STATE will be returned.
ResultCode Reset();
2020-12-31 14:03:11 +04:00
void Signal();
2021-01-12 13:22:33 +04:00
bool IsSignaled() const override;
2020-12-28 19:15:37 +04:00
private:
explicit ReadableEvent(KernelCore& kernel);
2020-12-31 14:03:11 +04:00
bool is_signaled{};
2020-12-28 19:15:37 +04:00
std::string name; ///< Name of event (optional)
};
} // namespace Kernel