diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-09-22 01:50:40 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-22 14:50:40 +1000 |
| commit | 6c9565693fd87ae1af81ed63b5fbdde2a5dbecb8 (patch) | |
| tree | f7d87a5e4aff1b3f0b446bbcc710fcb89ffc288f /Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs | |
| parent | 5dd6f41ff456c2d9a72d9e6d88c4be851bac1f96 (diff) | |
IPC refactor part 1: Use explicit separate threads to process requests (#1447)
* Changes to allow explicit management of service threads
* Remove now unused code
* Remove ThreadCounter, its no longer needed
* Allow and use separate server per service, also fix exit issues
* New policy change: PTC version now uses PR number
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index 37f0a23c..d8f31faf 100644 --- a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -18,9 +18,11 @@ namespace Ryujinx.HLE.HOS.Services.Sm private ConcurrentDictionary<string, KPort> _registeredServices; + private readonly ServerBase _commonServer; + private bool _isInitialized; - public IUserInterface(ServiceCtx context = null) + public IUserInterface(ServiceCtx context = null) : base(new ServerBase("SmServer")) { _registeredServices = new ConcurrentDictionary<string, KPort>(); @@ -28,6 +30,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm .SelectMany(type => type.GetCustomAttributes(typeof(ServiceAttribute), true) .Select(service => (((ServiceAttribute)service).Name, type))) .ToDictionary(service => service.Name, service => service.type); + + _commonServer = new ServerBase("CommonServer"); } public static void InitializePort(Horizon system) @@ -36,7 +40,9 @@ namespace Ryujinx.HLE.HOS.Services.Sm port.ClientPort.SetName("sm:"); - port.ClientPort.Service = new IUserInterface(); + IUserInterface smService = new IUserInterface(); + + port.ClientPort.Service = smService; } [Command(0)] @@ -81,8 +87,13 @@ namespace Ryujinx.HLE.HOS.Services.Sm { ServiceAttribute serviceAttribute = (ServiceAttribute)type.GetCustomAttributes(typeof(ServiceAttribute)).First(service => ((ServiceAttribute)service).Name == name); - session.ClientSession.Service = serviceAttribute.Parameter != null ? (IpcService)Activator.CreateInstance(type, context, serviceAttribute.Parameter) - : (IpcService)Activator.CreateInstance(type, context); + IpcService service = serviceAttribute.Parameter != null + ? (IpcService)Activator.CreateInstance(type, context, serviceAttribute.Parameter) + : (IpcService)Activator.CreateInstance(type, context); + + service.TrySetServer(_commonServer); + + session.ClientSession.Service = service; } else { |
