Browse Source

fix: increase FD_SETSIZE to 1024 and adjust bitset size

pull/19426/head
Brycen G 8 months ago
parent
commit
c81e8c62ce
No known key found for this signature in database GPG Key ID: BC52F2FACBA3772C
  1. 16
      src/Avalonia.X11/Dispatching/X11PlatformThreading.cs

16
src/Avalonia.X11/Dispatching/X11PlatformThreading.cs

@ -16,15 +16,15 @@ namespace Avalonia.X11
[StructLayout(LayoutKind.Sequential)]
public struct fd_set
{
public const int FD_SETSIZE = 64;
public fixed uint fds[FD_SETSIZE];
public const int FD_SETSIZE = 1024;
public fixed uint fds[FD_SETSIZE / 32];
public void Set(int fd)
{
var idx = fd / 32;
if (idx >= FD_SETSIZE)
throw new ArgumentException();
var bit = (fd % 32);
if (idx >= FD_SETSIZE / 32)
throw new ArgumentOutOfRangeException(nameof(fd));
var bit = fd % 32;
fds[idx] |= 1u << bit;
}
}
@ -61,12 +61,6 @@ namespace Avalonia.X11
[DllImport("libc")]
private extern static IntPtr read(int fd, void* buf, IntPtr count);
private enum EventCodes
{
X11 = 1,
Signal = 2
}
private readonly int _sigread, _sigwrite, _x11Fd;
private object _lock = new object();
private bool _signaled;

Loading…
Cancel
Save