services: am: Clear events on PopOutData and PopInteractiveOutData.

This commit is contained in:
bunnei
2020-01-26 00:21:05 -05:00
parent d0b11cc116
commit 64a39b838d
3 changed files with 16 additions and 14 deletions

View File

@@ -778,11 +778,9 @@ private:
void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
const auto event = applet->GetBroker().GetStateChangedEvent();
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(event); rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent()->GetReadableEvent());
} }
void IsCompleted(Kernel::HLERequestContext& ctx) { void IsCompleted(Kernel::HLERequestContext& ctx) {
@@ -836,6 +834,8 @@ private:
return; return;
} }
applet->GetBroker().GetNormalDataEvent()->Clear();
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IStorage>(std::move(*storage)); rb.PushIpcInterface<IStorage>(std::move(*storage));
} }
@@ -868,6 +868,8 @@ private:
return; return;
} }
applet->GetBroker().GetInteractiveDataEvent()->Clear();
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IStorage>(std::move(*storage)); rb.PushIpcInterface<IStorage>(std::move(*storage));
} }
@@ -877,7 +879,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()->GetReadableEvent());
} }
void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) { void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) {
@@ -885,7 +887,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()->GetReadableEvent());
} }
std::shared_ptr<Applets::Applet> applet; std::shared_ptr<Applets::Applet> applet;

View File

@@ -108,16 +108,16 @@ void AppletDataBroker::SignalStateChanged() const {
state_changed_event.writable->Signal(); state_changed_event.writable->Signal();
} }
std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetNormalDataEvent() const { std::shared_ptr<Kernel::WritableEvent> AppletDataBroker::GetNormalDataEvent() const {
return pop_out_data_event.readable; return pop_out_data_event.writable;
} }
std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetInteractiveDataEvent() const { std::shared_ptr<Kernel::WritableEvent> AppletDataBroker::GetInteractiveDataEvent() const {
return pop_interactive_out_data_event.readable; return pop_interactive_out_data_event.writable;
} }
std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetStateChangedEvent() const { std::shared_ptr<Kernel::WritableEvent> AppletDataBroker::GetStateChangedEvent() const {
return state_changed_event.readable; return state_changed_event.writable;
} }
Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {} Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {}

View File

@@ -86,9 +86,9 @@ public:
void SignalStateChanged() const; void SignalStateChanged() const;
std::shared_ptr<Kernel::ReadableEvent> GetNormalDataEvent() const; std::shared_ptr<Kernel::WritableEvent> GetNormalDataEvent() const;
std::shared_ptr<Kernel::ReadableEvent> GetInteractiveDataEvent() const; std::shared_ptr<Kernel::WritableEvent> GetInteractiveDataEvent() const;
std::shared_ptr<Kernel::ReadableEvent> GetStateChangedEvent() const; std::shared_ptr<Kernel::WritableEvent> GetStateChangedEvent() const;
private: private:
// Queues are named from applet's perspective // Queues are named from applet's perspective