From 65385544858a7244313ae63717aeb8fa2c25e7e6 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 7 Nov 2018 23:20:48 -0800 Subject: [PATCH] libstratosphere: add ReadOnlySystemEvent helper --- .../libstratosphere/include/stratosphere/event.hpp | 5 +++++ .../include/stratosphere/message_queue.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/stratosphere/libstratosphere/include/stratosphere/event.hpp b/stratosphere/libstratosphere/include/stratosphere/event.hpp index ba726d557..153cdd0df 100644 --- a/stratosphere/libstratosphere/include/stratosphere/event.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/event.hpp @@ -125,3 +125,8 @@ template static IEvent *CreateWriteOnlySystemEvent() { return CreateSystemEvent([](u64 timeout) { std::abort(); return 0; }, a); } + +template +static IEvent *LoadReadOnlySystemEvent(Handle r_h, F f, bool autoclear = false) { + return new HosEvent(r_h, f, autoclear); +} diff --git a/stratosphere/libstratosphere/include/stratosphere/message_queue.hpp b/stratosphere/libstratosphere/include/stratosphere/message_queue.hpp index f8b4c6591..8ed2bae7f 100644 --- a/stratosphere/libstratosphere/include/stratosphere/message_queue.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/message_queue.hpp @@ -56,11 +56,6 @@ class HosMessageQueue { bool TryPeek(uintptr_t *out); bool TimedPeek(uintptr_t *out, u64 timeout); private: - void SendInternal(uintptr_t data); - void SendNextInternal(uintptr_t data); - uintptr_t ReceiveInternal(); - uintptr_t PeekInternal(); - bool IsFull() { return this->count >= this->capacity; } @@ -68,6 +63,11 @@ class HosMessageQueue { bool IsEmpty() { return this->count == 0; } + + void SendInternal(uintptr_t data); + void SendNextInternal(uintptr_t data); + uintptr_t ReceiveInternal(); + uintptr_t PeekInternal(); };