0
0
Fork 0

Less invasive fix for EventFd blocking operations (#3394)

This commit is contained in:
gdkchan 2022-06-12 04:29:12 -03:00 committed by GitHub
parent 70895bdb04
commit b1bd6a50b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 26 deletions

View file

@ -309,7 +309,7 @@ namespace Ryujinx.HLE.HOS
// only then doing connections to SM is safe.
SmServer.InitDone.WaitOne();
BsdServer = new ServerBase(KernelContext, "BsdServer", null, 2);
BsdServer = new ServerBase(KernelContext, "BsdServer");
AudRenServer = new ServerBase(KernelContext, "AudioRendererServer");
AudOutServer = new ServerBase(KernelContext, "AudioOutServer");
FsServer = new ServerBase(KernelContext, "FsServer");

View file

@ -42,15 +42,12 @@ namespace Ryujinx.HLE.HOS.Services
public string Name { get; }
public Func<IpcService> SmObjectFactory { get; }
private int _threadCount;
public ServerBase(KernelContext context, string name, Func<IpcService> smObjectFactory = null, int threadCount = 1)
public ServerBase(KernelContext context, string name, Func<IpcService> smObjectFactory = null)
{
InitDone = new ManualResetEvent(false);
_context = context;
Name = name;
SmObjectFactory = smObjectFactory;
_threadCount = threadCount;
const ProcessCreationFlags flags =
ProcessCreationFlags.EnableAslr |
@ -86,27 +83,6 @@ namespace Ryujinx.HLE.HOS.Services
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();
}

View file

@ -18,6 +18,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
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;
_flags = flags;