Less invasive fix for EventFd blocking operations (#3394)
This commit is contained in:
parent
70895bdb04
commit
b1bd6a50b5
3 changed files with 7 additions and 26 deletions
|
@ -309,7 +309,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
// only then doing connections to SM is safe.
|
// only then doing connections to SM is safe.
|
||||||
SmServer.InitDone.WaitOne();
|
SmServer.InitDone.WaitOne();
|
||||||
|
|
||||||
BsdServer = new ServerBase(KernelContext, "BsdServer", null, 2);
|
BsdServer = new ServerBase(KernelContext, "BsdServer");
|
||||||
AudRenServer = new ServerBase(KernelContext, "AudioRendererServer");
|
AudRenServer = new ServerBase(KernelContext, "AudioRendererServer");
|
||||||
AudOutServer = new ServerBase(KernelContext, "AudioOutServer");
|
AudOutServer = new ServerBase(KernelContext, "AudioOutServer");
|
||||||
FsServer = new ServerBase(KernelContext, "FsServer");
|
FsServer = new ServerBase(KernelContext, "FsServer");
|
||||||
|
|
|
@ -42,15 +42,12 @@ namespace Ryujinx.HLE.HOS.Services
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public Func<IpcService> SmObjectFactory { get; }
|
public Func<IpcService> SmObjectFactory { get; }
|
||||||
|
|
||||||
private int _threadCount;
|
public ServerBase(KernelContext context, string name, Func<IpcService> smObjectFactory = null)
|
||||||
|
|
||||||
public ServerBase(KernelContext context, string name, Func<IpcService> smObjectFactory = null, int threadCount = 1)
|
|
||||||
{
|
{
|
||||||
InitDone = new ManualResetEvent(false);
|
InitDone = new ManualResetEvent(false);
|
||||||
_context = context;
|
_context = context;
|
||||||
Name = name;
|
Name = name;
|
||||||
SmObjectFactory = smObjectFactory;
|
SmObjectFactory = smObjectFactory;
|
||||||
_threadCount = threadCount;
|
|
||||||
|
|
||||||
const ProcessCreationFlags flags =
|
const ProcessCreationFlags flags =
|
||||||
ProcessCreationFlags.EnableAslr |
|
ProcessCreationFlags.EnableAslr |
|
||||||
|
@ -86,27 +83,6 @@ namespace Ryujinx.HLE.HOS.Services
|
||||||
|
|
||||||
private void Main()
|
private void Main()
|
||||||
{
|
{
|
||||||
for (int i = 1; i < _threadCount; i++)
|
|
||||||
{
|
|
||||||
KernelResult result = _context.Syscall.CreateThread(out int threadHandle, 0UL, 0UL, 0UL, 44, 3, ServerLoop);
|
|
||||||
|
|
||||||
if (result == KernelResult.Success)
|
|
||||||
{
|
|
||||||
result = _context.Syscall.StartThread(threadHandle);
|
|
||||||
|
|
||||||
if (result != KernelResult.Success)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Service, $"Failed to start thread on {Name}: {result}");
|
|
||||||
}
|
|
||||||
|
|
||||||
_context.Syscall.CloseHandle(threadHandle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Service, $"Failed to create thread on {Name}: {result}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerLoop();
|
ServerLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
|
|
||||||
public EventFileDescriptor(ulong value, EventFdFlags flags)
|
public EventFileDescriptor(ulong value, EventFdFlags flags)
|
||||||
{
|
{
|
||||||
|
// FIXME: We should support blocking operations.
|
||||||
|
// Right now they can't be supported because it would cause the
|
||||||
|
// service to lock up as we only have one thread processing requests.
|
||||||
|
flags |= EventFdFlags.NonBlocking;
|
||||||
|
|
||||||
_value = value;
|
_value = value;
|
||||||
_flags = flags;
|
_flags = flags;
|
||||||
|
|
||||||
|
|
Reference in a new issue