bsd: Fix eventfd broken logic (#3647)
* bsd: Fix eventfd broken logic This commit fix eventfd logic being broken. The following changes were made: - EventFd IPC definition had argument inverted - EventFd events weren't fired correctly - Poll logic was wrong and unfinished for eventfd - Reintroduce workaround from #3385 but in a safer way, and spawn 4 threads. * ipc: Rework a bit for multithreads * Clean up debug logs * Make server thread yield when managed lock isn't availaible * Fix replyTargetHandle not being added in the proper locking scope * Simplify some scopes * Address gdkchan's comments * Revert IPC workaround for now * Reintroduce the EventFileDescriptor workaround
This commit is contained in:
parent
18b61aff59
commit
1865ea87e5
3 changed files with 60 additions and 17 deletions
|
@ -68,20 +68,37 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
|||
{
|
||||
for (int i = 0; i < events.Count; i++)
|
||||
{
|
||||
PollEventTypeMask outputEvents = 0;
|
||||
|
||||
PollEvent evnt = events[i];
|
||||
|
||||
EventFileDescriptor socket = (EventFileDescriptor)evnt.FileDescriptor;
|
||||
|
||||
if ((evnt.Data.InputEvents.HasFlag(PollEventTypeMask.Input) ||
|
||||
evnt.Data.InputEvents.HasFlag(PollEventTypeMask.UrgentInput))
|
||||
&& socket.ReadEvent.WaitOne(0))
|
||||
if (socket.ReadEvent.WaitOne(0))
|
||||
{
|
||||
waiters.Add(socket.ReadEvent);
|
||||
if (evnt.Data.InputEvents.HasFlag(PollEventTypeMask.Input))
|
||||
{
|
||||
outputEvents |= PollEventTypeMask.Input;
|
||||
}
|
||||
|
||||
if (evnt.Data.InputEvents.HasFlag(PollEventTypeMask.UrgentInput))
|
||||
{
|
||||
outputEvents |= PollEventTypeMask.UrgentInput;
|
||||
}
|
||||
}
|
||||
|
||||
if ((evnt.Data.InputEvents.HasFlag(PollEventTypeMask.Output))
|
||||
&& socket.WriteEvent.WaitOne(0))
|
||||
{
|
||||
waiters.Add(socket.WriteEvent);
|
||||
outputEvents |= PollEventTypeMask.Output;
|
||||
}
|
||||
|
||||
|
||||
if (outputEvents != 0)
|
||||
{
|
||||
evnt.Data.OutputEvents = outputEvents;
|
||||
|
||||
updatedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue