2018-11-27 00:31:22 +01:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/hle/kernel/object.h"
|
|
|
|
#include "core/hle/kernel/readable_event.h"
|
|
|
|
#include "core/hle/kernel/thread.h"
|
|
|
|
#include "core/hle/kernel/writable_event.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2018-11-27 15:18:29 +01:00
|
|
|
WritableEvent::WritableEvent(KernelCore& kernel) : Object{kernel} {}
|
2018-11-27 00:31:22 +01:00
|
|
|
WritableEvent::~WritableEvent() = default;
|
|
|
|
|
2018-11-27 15:18:29 +01:00
|
|
|
EventPair WritableEvent::CreateEventPair(KernelCore& kernel, ResetType reset_type,
|
|
|
|
std::string name) {
|
2018-11-27 00:31:22 +01:00
|
|
|
SharedPtr<WritableEvent> writable_event(new WritableEvent(kernel));
|
|
|
|
SharedPtr<ReadableEvent> readable_event(new ReadableEvent(kernel));
|
|
|
|
|
|
|
|
writable_event->name = name + ":Writable";
|
2018-11-27 15:18:29 +01:00
|
|
|
writable_event->readable = readable_event;
|
2018-11-27 00:31:22 +01:00
|
|
|
readable_event->name = name + ":Readable";
|
2018-11-27 15:18:29 +01:00
|
|
|
readable_event->signaled = false;
|
|
|
|
readable_event->reset_type = reset_type;
|
2018-11-27 00:31:22 +01:00
|
|
|
|
2018-11-27 15:18:29 +01:00
|
|
|
return {std::move(readable_event), std::move(writable_event)};
|
2018-11-27 00:31:22 +01:00
|
|
|
}
|
|
|
|
|
2018-11-27 15:18:29 +01:00
|
|
|
ResetType WritableEvent::GetResetType() const {
|
|
|
|
return readable->reset_type;
|
2018-11-27 00:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void WritableEvent::Signal() {
|
2018-11-27 15:18:29 +01:00
|
|
|
readable->Signal();
|
2018-11-27 00:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void WritableEvent::Clear() {
|
2018-11-27 15:18:29 +01:00
|
|
|
readable->Clear();
|
2018-11-27 00:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WritableEvent::IsSignaled() const {
|
2018-11-27 15:18:29 +01:00
|
|
|
return readable->signaled;
|
2018-11-27 00:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Kernel
|