Name
build_fd_event — Create an event event relating to an open file descriptor
Synopsis
#include "event.h"
| Event * **build_fd_event** ( | fd, | |
| | mask, | |
| | aggressive, | |
| | callback, | |
| | closure); | |
int <var class="pdparam">fd</var>;
int <var class="pdparam">mask</var>;
int <var class="pdparam">aggressive</var>;
EventFunc <var class="pdparam">callback</var>;
void *<var class="pdparam">closure</var>;
Description
Create a file descriptor event. The Event structure encapsulates a file descriptor and an action that should be triggered when IO is signalled on that descriptor.
- fd
-
The file descriptor.
- mask
-
The event or events that you are waiting for, for example,
E_READ|E_EXCEPTION. See “Event” for a complete list of the constants applicable to this parameter. - aggressive
-
With this parameter set to
E_AGGRESSIVE_NONEthe event callout is invoked once per scheduler iteration. With it set to E_AGGRESSIVE_HIGH it is called in a tight loop until there is no pending IO. This higher setting should only be used if you know what you are doing. See “Event” for a complete list of the constants applicable to this parameter. - callback
-
The callback function. The requirements for this function are described at “The Event API”.
- closure
-
The closure, the contextual data needed for the event callback to perform its task.
This function returns an Event.
Warning
Only call this function from the Scheduler thread.