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
This commit is contained in:
parent
5dd6f41ff4
commit
6c9565693f
18 changed files with 138 additions and 135 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue