diff options
author | Mary-nyan <mary@mary.zone> | 2022-11-27 21:18:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-27 20:18:05 +0000 |
commit | 1865ea87e538047efaf36c7a707c30390d620496 (patch) | |
tree | 4acebf5eca8b4dd5af8572f6d3a3abaa96f2becb /Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs | |
parent | 18b61aff59783e0e9dd01c2d45c44406a47b82a9 (diff) |
bsd: Fix eventfd broken logic (#3647)1.1.392
* 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
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs index 8bd9652b..6501d111 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs @@ -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++; } } } |