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/IpcService.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/IpcService.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/IpcService.cs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Ryujinx.HLE/HOS/Services/IpcService.cs b/Ryujinx.HLE/HOS/Services/IpcService.cs index cff1b816..9d40d80f 100644 --- a/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -15,13 +15,13 @@ namespace Ryujinx.HLE.HOS.Services { public IReadOnlyDictionary<int, MethodInfo> Commands { get; } - private IdDictionary _domainObjects; + public ServerBase Server { get; private set; } + private IdDictionary _domainObjects; private int _selfId; - private bool _isDomain; - public IpcService() + public IpcService(ServerBase server = null) { Commands = Assembly.GetExecutingAssembly().GetTypes() .Where(type => type == GetType()) @@ -30,8 +30,9 @@ namespace Ryujinx.HLE.HOS.Services .Select(command => (((CommandAttribute)command).Id, methodInfo))) .ToDictionary(command => command.Id, command => command.methodInfo); - _domainObjects = new IdDictionary(); + Server = server; + _domainObjects = new IdDictionary(); _selfId = -1; } @@ -152,6 +153,8 @@ namespace Ryujinx.HLE.HOS.Services { IpcService service = context.Session.Service; + obj.TrySetServer(service.Server); + if (service._isDomain) { context.Response.ObjectIds.Add(service.Add(obj)); @@ -194,6 +197,18 @@ namespace Ryujinx.HLE.HOS.Services return obj is T ? (T)obj : null; } + public bool TrySetServer(ServerBase newServer) + { + if (Server == null) + { + Server = newServer; + + return true; + } + + return false; + } + private int Add(IIpcService obj) { return _domainObjects.Add(obj); |