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