2018-11-26 15:31:22 -08: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 06:18:29 -08:00
|
|
|
WritableEvent::WritableEvent(KernelCore& kernel) : Object{kernel} {}
|
2018-11-26 15:31:22 -08:00
|
|
|
WritableEvent::~WritableEvent() = default;
|
|
|
|
|
2019-11-03 01:10:12 -08:00
|
|
|
EventPair WritableEvent::CreateEventPair(KernelCore& kernel, std::string name) {
|
2019-11-24 17:15:51 -08:00
|
|
|
std::shared_ptr<WritableEvent> writable_event(new WritableEvent(kernel));
|
|
|
|
std::shared_ptr<ReadableEvent> readable_event(new ReadableEvent(kernel));
|
2018-11-26 15:31:22 -08:00
|
|
|
|
|
|
|
writable_event->name = name + ":Writable";
|
2018-11-27 06:18:29 -08:00
|
|
|
writable_event->readable = readable_event;
|
2018-11-26 15:31:22 -08:00
|
|
|
readable_event->name = name + ":Readable";
|
2018-11-27 06:18:29 -08:00
|
|
|
readable_event->signaled = false;
|
2018-11-26 15:31:22 -08:00
|
|
|
|
2018-11-27 06:18:29 -08:00
|
|
|
return {std::move(readable_event), std::move(writable_event)};
|
2018-11-26 15:31:22 -08:00
|
|
|
}
|
|
|
|
|
2019-11-24 17:15:51 -08:00
|
|
|
std::shared_ptr<ReadableEvent> WritableEvent::GetReadableEvent() const {
|
2018-11-29 06:14:12 -08:00
|
|
|
return readable;
|
|
|
|
}
|
|
|
|
|
2018-11-26 15:31:22 -08:00
|
|
|
void WritableEvent::Signal() {
|
2018-11-27 06:18:29 -08:00
|
|
|
readable->Signal();
|
2018-11-26 15:31:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void WritableEvent::Clear() {
|
2018-11-27 06:18:29 -08:00
|
|
|
readable->Clear();
|
2018-11-26 15:31:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WritableEvent::IsSignaled() const {
|
2018-11-27 06:18:29 -08:00
|
|
|
return readable->signaled;
|
2018-11-26 15:31:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Kernel
|