public unsafe bool TryRegister(int fileDescriptor, SocketAsyncEvents current, SocketAsyncEvents events, GCHandle handle, out Interop.Error error)
        {
            Debug.Assert(current != events);

            int op = Interop.libc.EPOLL_CTL_MOD;

            if (current == SocketAsyncEvents.None)
            {
                // This context was not listening for events, add it
                op = Interop.libc.EPOLL_CTL_ADD;
            }
            else if (events == SocketAsyncEvents.None)
            {
                // This context will no longer be listening for events, remove it
                op = Interop.libc.EPOLL_CTL_DEL;
            }

            // Register events
            var evt = new Interop.libc.epoll_event {
                events = GetEPollEvents(events) | Interop.libc.EPOLLET, data = (IntPtr)handle
            };
            int err = Interop.libc.epoll_ctl(_epollFd, op, fileDescriptor, &evt);

            if (err == 0)
            {
                error = Interop.Error.SUCCESS;
                return(true);
            }

            error = Interop.Sys.GetLastError();
            return(false);
        }
        public unsafe bool TryRegister(int fileDescriptor, SocketAsyncEvents current, SocketAsyncEvents events, GCHandle handle, out Interop.Error error)
        {
            Debug.Assert(current != events);

            int op = Interop.libc.EPOLL_CTL_MOD;
            if (current == SocketAsyncEvents.None)
            {
                // This context was not listening for events, add it
                op = Interop.libc.EPOLL_CTL_ADD;
            }
            else if (events == SocketAsyncEvents.None)
            {
                // This context will no longer be listening for events, remove it
                op = Interop.libc.EPOLL_CTL_DEL;
            }

            // Register events
            var evt = new Interop.libc.epoll_event { events = GetEPollEvents(events) | Interop.libc.EPOLLET, data = (IntPtr)handle };
            int err = Interop.libc.epoll_ctl(_epollFd, op, fileDescriptor, &evt);
            if (err == 0)
            {
                error = Interop.Error.SUCCESS;
                return true;
            }

            error = Interop.Sys.GetLastError();
            return false;
        }