From 94c1e5724bdb6db10b74c1d9de76ebed0586d9d6 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 --- include/stratosphere/event.hpp | 5 +++++ include/stratosphere/message_queue.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/stratosphere/event.hpp b/include/stratosphere/event.hpp index ba726d55..153cdd0d 100644 --- a/include/stratosphere/event.hpp +++ b/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/include/stratosphere/message_queue.hpp b/include/stratosphere/message_queue.hpp index f8b4c659..8ed2bae7 100644 --- a/include/stratosphere/message_queue.hpp +++ b/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(); };