os: adopt multiwait naming over waitable
This commit is contained in:
@@ -28,8 +28,8 @@ namespace ams::sf::hipc {
|
||||
NeedsRetry,
|
||||
};
|
||||
|
||||
void AttachWaitableHolderForAccept(os::WaitableHolderType *holder, Handle port);
|
||||
void AttachWaitableHolderForReply(os::WaitableHolderType *holder, Handle request);
|
||||
void AttachMultiWaitHolderForAccept(os::MultiWaitHolderType *holder, Handle port);
|
||||
void AttachMultiWaitHolderForReply(os::MultiWaitHolderType *holder, Handle request);
|
||||
|
||||
Result Receive(ReceiveResult *out_recv_result, Handle session_handle, const cmif::PointerAndSize &message_buffer);
|
||||
Result Receive(bool *out_closed, Handle session_handle, const cmif::PointerAndSize &message_buffer);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ams::sf::hipc {
|
||||
using ServerDomainSessionManager::DomainEntryStorage;
|
||||
using ServerDomainSessionManager::DomainStorage;
|
||||
protected:
|
||||
class Server : public os::WaitableHolderType {
|
||||
class Server : public os::MultiWaitHolderType {
|
||||
friend class ServerManagerBase;
|
||||
template<size_t, typename, size_t>
|
||||
friend class ServerManager;
|
||||
@@ -73,42 +73,42 @@ namespace ams::sf::hipc {
|
||||
}
|
||||
};
|
||||
private:
|
||||
/* Management of waitables. */
|
||||
os::WaitableManagerType waitable_manager;
|
||||
/* Multiple wait management. */
|
||||
os::MultiWaitType multi_wait;
|
||||
os::Event request_stop_event;
|
||||
os::WaitableHolderType request_stop_event_holder;
|
||||
os::MultiWaitHolderType request_stop_event_holder;
|
||||
os::Event notify_event;
|
||||
os::WaitableHolderType notify_event_holder;
|
||||
os::MultiWaitHolderType notify_event_holder;
|
||||
|
||||
os::SdkMutex waitable_selection_mutex;
|
||||
os::SdkMutex selection_mutex;
|
||||
|
||||
os::SdkMutex waitlist_mutex;
|
||||
os::WaitableManagerType waitlist;
|
||||
os::SdkMutex deferred_list_mutex;
|
||||
os::MultiWaitType deferred_list;
|
||||
private:
|
||||
virtual void RegisterSessionToWaitList(ServerSession *session) override final;
|
||||
void RegisterToWaitList(os::WaitableHolderType *holder);
|
||||
void ProcessWaitList();
|
||||
virtual void RegisterServerSessionToWait(ServerSession *session) override final;
|
||||
void LinkToDeferredList(os::MultiWaitHolderType *holder);
|
||||
void LinkDeferred();
|
||||
|
||||
bool WaitAndProcessImpl();
|
||||
|
||||
Result ProcessForServer(os::WaitableHolderType *holder);
|
||||
Result ProcessForMitmServer(os::WaitableHolderType *holder);
|
||||
Result ProcessForSession(os::WaitableHolderType *holder);
|
||||
Result ProcessForServer(os::MultiWaitHolderType *holder);
|
||||
Result ProcessForMitmServer(os::MultiWaitHolderType *holder);
|
||||
Result ProcessForSession(os::MultiWaitHolderType *holder);
|
||||
|
||||
void RegisterServerImpl(Server *server, Handle port_handle, bool is_mitm_server) {
|
||||
server->port_handle = port_handle;
|
||||
hipc::AttachWaitableHolderForAccept(server, port_handle);
|
||||
hipc::AttachMultiWaitHolderForAccept(server, port_handle);
|
||||
|
||||
server->is_mitm_server = is_mitm_server;
|
||||
if (is_mitm_server) {
|
||||
/* Mitm server. */
|
||||
os::SetWaitableHolderUserData(server, static_cast<uintptr_t>(UserDataTag::MitmServer));
|
||||
os::SetMultiWaitHolderUserData(server, static_cast<uintptr_t>(UserDataTag::MitmServer));
|
||||
} else {
|
||||
/* Non-mitm server. */
|
||||
os::SetWaitableHolderUserData(server, static_cast<uintptr_t>(UserDataTag::Server));
|
||||
os::SetMultiWaitHolderUserData(server, static_cast<uintptr_t>(UserDataTag::Server));
|
||||
}
|
||||
|
||||
os::LinkWaitableHolder(std::addressof(this->waitable_manager), server);
|
||||
os::LinkMultiWaitHolder(std::addressof(this->multi_wait), server);
|
||||
}
|
||||
|
||||
void RegisterServerImpl(int index, cmif::ServiceObjectHolder &&static_holder, Handle port_handle, bool is_mitm_server) {
|
||||
@@ -192,15 +192,16 @@ namespace ams::sf::hipc {
|
||||
ServerManagerBase(DomainEntryStorage *entry_storage, size_t entry_count) :
|
||||
ServerDomainSessionManager(entry_storage, entry_count),
|
||||
request_stop_event(os::EventClearMode_ManualClear), notify_event(os::EventClearMode_ManualClear),
|
||||
waitable_selection_mutex(), waitlist_mutex()
|
||||
selection_mutex(), deferred_list_mutex()
|
||||
{
|
||||
/* Link waitables. */
|
||||
os::InitializeWaitableManager(std::addressof(this->waitable_manager));
|
||||
os::InitializeWaitableHolder(std::addressof(this->request_stop_event_holder), this->request_stop_event.GetBase());
|
||||
os::LinkWaitableHolder(std::addressof(this->waitable_manager), std::addressof(this->request_stop_event_holder));
|
||||
os::InitializeWaitableHolder(std::addressof(this->notify_event_holder), this->notify_event.GetBase());
|
||||
os::LinkWaitableHolder(std::addressof(this->waitable_manager), std::addressof(this->notify_event_holder));
|
||||
os::InitializeWaitableManager(std::addressof(this->waitlist));
|
||||
/* Link multi-wait holders. */
|
||||
os::InitializeMultiWait(std::addressof(this->multi_wait));
|
||||
os::InitializeMultiWaitHolder(std::addressof(this->request_stop_event_holder), this->request_stop_event.GetBase());
|
||||
os::LinkMultiWaitHolder(std::addressof(this->multi_wait), std::addressof(this->request_stop_event_holder));
|
||||
os::InitializeMultiWaitHolder(std::addressof(this->notify_event_holder), this->notify_event.GetBase());
|
||||
os::LinkMultiWaitHolder(std::addressof(this->multi_wait), std::addressof(this->notify_event_holder));
|
||||
|
||||
os::InitializeMultiWait(std::addressof(this->deferred_list));
|
||||
}
|
||||
|
||||
template<typename Interface>
|
||||
@@ -227,13 +228,13 @@ namespace ams::sf::hipc {
|
||||
}
|
||||
|
||||
/* Processing. */
|
||||
os::WaitableHolderType *WaitSignaled();
|
||||
os::MultiWaitHolderType *WaitSignaled();
|
||||
|
||||
void ResumeProcessing();
|
||||
void RequestStopProcessing();
|
||||
void AddUserWaitableHolder(os::WaitableHolderType *waitable);
|
||||
void AddUserMultiWaitHolder(os::MultiWaitHolderType *holder);
|
||||
|
||||
Result Process(os::WaitableHolderType *waitable);
|
||||
Result Process(os::MultiWaitHolderType *holder);
|
||||
void WaitAndProcess();
|
||||
void LoopProcess();
|
||||
};
|
||||
@@ -324,8 +325,8 @@ namespace ams::sf::hipc {
|
||||
const size_t index = this->GetServerIndex(server);
|
||||
AMS_ABORT_UNLESS(this->server_allocated[index]);
|
||||
{
|
||||
os::UnlinkWaitableHolder(server);
|
||||
os::FinalizeWaitableHolder(server);
|
||||
os::UnlinkMultiWaitHolder(server);
|
||||
os::FinalizeMultiWaitHolder(server);
|
||||
if (server->service_managed) {
|
||||
if (server->is_mitm_server) {
|
||||
R_ABORT_UNLESS(sm::mitm::UninstallMitm(server->service_name));
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ams::sf::hipc {
|
||||
|
||||
}
|
||||
|
||||
class ServerSession : public os::WaitableHolderType {
|
||||
class ServerSession : public os::MultiWaitHolderType {
|
||||
friend class ServerSessionManager;
|
||||
friend class ServerManagerBase;
|
||||
friend class impl::HipcManagerImpl;
|
||||
@@ -54,7 +54,7 @@ namespace ams::sf::hipc {
|
||||
bool has_received;
|
||||
public:
|
||||
ServerSession(Handle h, cmif::ServiceObjectHolder &&obj) : srv_obj_holder(std::move(obj)), session_handle(h) {
|
||||
hipc::AttachWaitableHolderForReply(this, h);
|
||||
hipc::AttachMultiWaitHolderForReply(this, h);
|
||||
this->is_closed = false;
|
||||
this->has_received = false;
|
||||
this->forward_service = nullptr;
|
||||
@@ -62,7 +62,7 @@ namespace ams::sf::hipc {
|
||||
}
|
||||
|
||||
ServerSession(Handle h, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) : srv_obj_holder(std::move(obj)), session_handle(h) {
|
||||
hipc::AttachWaitableHolderForReply(this, h);
|
||||
hipc::AttachMultiWaitHolderForReply(this, h);
|
||||
this->is_closed = false;
|
||||
this->has_received = false;
|
||||
this->forward_service = std::move(fsrv);
|
||||
@@ -105,7 +105,7 @@ namespace ams::sf::hipc {
|
||||
void DestroySession(ServerSession *session);
|
||||
|
||||
Result ProcessRequestImpl(ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message);
|
||||
virtual void RegisterSessionToWaitList(ServerSession *session) = 0;
|
||||
virtual void RegisterServerSessionToWait(ServerSession *session) = 0;
|
||||
protected:
|
||||
Result DispatchRequest(cmif::ServiceObjectHolder &&obj, ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message);
|
||||
virtual Result DispatchManagerRequest(ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message);
|
||||
|
||||
Reference in New Issue
Block a user