Споделяне чрез


EventLoop_RegisterIo Function

Header: #include <applibs/eventloop.h>

Registers an I/O event with an EventLoop.

EventRegistration *EventLoop_RegisterIo(EventLoop *el, int fd, EventLoop_IoEvents eventBitmask,
                                        EventLoopIoCallback *callback, void *context);

Parameters

  • el The EventLoop on which to register the I/O event.

  • fd The file descriptor for the I/O event.

  • eventBitmask The bitmask of events to monitor.

  • callback A pointer to the callback function to call whenever a monitored event is raised.

  • context An optional context pointer.

Return value

Returns a pointer to an EventRegistration object on success, otherwise NULL for failure, in which case errno is set to the error value.

Remarks

If this function succeeds, it returns a pointer to an EventRegistration object that tracks the registration operation. The EventRegistration object remains active until the application calls EventLoop_UnregisterIo on the object or closes the object with EventLoop_Close.