2014-05-27 17:16:13 -07:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-16 21:38:14 -08:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-11-19 00:49:13 -08:00
|
|
|
// Refer to the license.txt file included.
|
2014-05-27 17:16:13 -07:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2015-01-26 20:40:21 -08:00
|
|
|
class Event final : public WaitObject {
|
2015-01-22 21:11:25 -08:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Creates an event
|
|
|
|
* @param reset_type ResetType describing how to create event
|
|
|
|
* @param name Optional name of event
|
|
|
|
*/
|
2015-01-31 18:14:40 -08:00
|
|
|
static SharedPtr<Event> Create(ResetType reset_type, std::string name = "Unknown");
|
2015-01-22 21:11:25 -08:00
|
|
|
|
2016-09-17 17:38:01 -07:00
|
|
|
std::string GetTypeName() const override {
|
|
|
|
return "Event";
|
|
|
|
}
|
|
|
|
std::string GetName() const override {
|
|
|
|
return name;
|
|
|
|
}
|
2015-01-22 21:11:25 -08:00
|
|
|
|
|
|
|
static const HandleType HANDLE_TYPE = HandleType::Event;
|
2016-09-17 17:38:01 -07:00
|
|
|
HandleType GetHandleType() const override {
|
|
|
|
return HANDLE_TYPE;
|
|
|
|
}
|
2015-01-22 21:11:25 -08:00
|
|
|
|
2016-09-17 17:38:01 -07:00
|
|
|
ResetType reset_type; ///< Current ResetType
|
2015-01-22 21:11:25 -08:00
|
|
|
|
2016-09-17 17:38:01 -07:00
|
|
|
bool signaled; ///< Whether the event has already been signaled
|
|
|
|
std::string name; ///< Name of event (optional)
|
2015-01-22 21:11:25 -08:00
|
|
|
|
2017-01-01 13:53:22 -08:00
|
|
|
bool ShouldWait(Thread* thread) const override;
|
|
|
|
void Acquire(Thread* thread) override;
|
2015-01-22 21:11:25 -08:00
|
|
|
|
2017-01-01 16:23:19 -08:00
|
|
|
void WakeupAllWaitingThreads() override;
|
|
|
|
|
2015-01-22 21:11:25 -08:00
|
|
|
void Signal();
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
private:
|
2015-01-31 16:56:59 -08:00
|
|
|
Event();
|
|
|
|
~Event() override;
|
2015-01-22 21:11:25 -08:00
|
|
|
};
|
2014-05-27 17:16:13 -07:00
|
|
|
|
|
|
|
} // namespace
|