mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-12 13:50:03 +00:00
Kernel: replace boost::intrusive_ptr with std::shared_ptr
This commit is contained in:
parent
c1de8acfe5
commit
5f11c5f733
96 changed files with 522 additions and 538 deletions
|
@ -32,7 +32,7 @@ void ServiceManager::InstallInterfaces(Core::System& system) {
|
|||
system.ServiceManager().srv_interface = srv;
|
||||
}
|
||||
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService(
|
||||
ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(
|
||||
std::string name, unsigned int max_sessions) {
|
||||
|
||||
CASCADE_CODE(ValidateServiceName(name));
|
||||
|
@ -46,7 +46,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService
|
|||
return MakeResult(std::move(server_port));
|
||||
}
|
||||
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> ServiceManager::GetServicePort(
|
||||
ResultVal<std::shared_ptr<Kernel::ClientPort>> ServiceManager::GetServicePort(
|
||||
const std::string& name) {
|
||||
|
||||
CASCADE_CODE(ValidateServiceName(name));
|
||||
|
@ -58,7 +58,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> ServiceManager::GetServicePort(
|
|||
return MakeResult(it->second);
|
||||
}
|
||||
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ServiceManager::ConnectToService(
|
||||
ResultVal<std::shared_ptr<Kernel::ClientSession>> ServiceManager::ConnectToService(
|
||||
const std::string& name) {
|
||||
|
||||
CASCADE_RESULT(auto client_port, GetServicePort(name));
|
||||
|
|
|
@ -47,10 +47,10 @@ public:
|
|||
|
||||
explicit ServiceManager(Core::System& system);
|
||||
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> RegisterService(std::string name,
|
||||
unsigned int max_sessions);
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name);
|
||||
ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ConnectToService(const std::string& name);
|
||||
ResultVal<std::shared_ptr<Kernel::ServerPort>> RegisterService(std::string name,
|
||||
unsigned int max_sessions);
|
||||
ResultVal<std::shared_ptr<Kernel::ClientPort>> GetServicePort(const std::string& name);
|
||||
ResultVal<std::shared_ptr<Kernel::ClientSession>> ConnectToService(const std::string& name);
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> GetService(const std::string& service_name) const {
|
||||
|
@ -73,7 +73,7 @@ private:
|
|||
std::weak_ptr<SRV> srv_interface;
|
||||
|
||||
/// Map of registered services, retrieved using GetServicePort or ConnectToService.
|
||||
std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> registered_services;
|
||||
std::unordered_map<std::string, std::shared_ptr<Kernel::ClientPort>> registered_services;
|
||||
};
|
||||
|
||||
} // namespace Service::SM
|
||||
|
|
|
@ -100,7 +100,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// TODO(yuriks): Permission checks go here
|
||||
|
||||
auto get_handle = [name, this](Kernel::SharedPtr<Kernel::Thread> thread,
|
||||
auto get_handle = [name, this](std::shared_ptr<Kernel::Thread> thread,
|
||||
Kernel::HLERequestContext& ctx,
|
||||
Kernel::ThreadWakeupReason reason) {
|
||||
LOG_ERROR(Service_SRV, "called service={} wakeup", name);
|
||||
|
@ -127,9 +127,9 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
|||
if (client_port.Failed()) {
|
||||
if (wait_until_available && client_port.Code() == ERR_SERVICE_NOT_REGISTERED) {
|
||||
LOG_INFO(Service_SRV, "called service={} delayed", name);
|
||||
Kernel::SharedPtr<Kernel::Event> get_service_handle_event =
|
||||
ctx.SleepClientThread(system.Kernel().GetThreadManager().GetCurrentThread(),
|
||||
"GetServiceHandle", std::chrono::nanoseconds(-1), get_handle);
|
||||
std::shared_ptr<Kernel::Event> get_service_handle_event = ctx.SleepClientThread(
|
||||
Kernel::SharedFrom(system.Kernel().GetThreadManager().GetCurrentThread()),
|
||||
"GetServiceHandle", std::chrono::nanoseconds(-1), get_handle);
|
||||
get_service_handle_delayed_map[name] = std::move(get_service_handle_event);
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -35,9 +35,8 @@ private:
|
|||
void RegisterService(Kernel::HLERequestContext& ctx);
|
||||
|
||||
Core::System& system;
|
||||
Kernel::SharedPtr<Kernel::Semaphore> notification_semaphore;
|
||||
std::unordered_map<std::string, Kernel::SharedPtr<Kernel::Event>>
|
||||
get_service_handle_delayed_map;
|
||||
std::shared_ptr<Kernel::Semaphore> notification_semaphore;
|
||||
std::unordered_map<std::string, std::shared_ptr<Kernel::Event>> get_service_handle_delayed_map;
|
||||
};
|
||||
|
||||
} // namespace Service::SM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue