TOC PREV NEXT INDEX

EVadd_select

Synopsis


void EVadd_select (int type,int fd, void (*function)
(char *), NULL, char* arg, int dir );
void EVdel_select (int type, int fd, void (*function)
(char *), NULL, char* arg, int dir );

Description

EVadd_select adds an event callback handler of type type .For all types, function is a pointer to a user-supplied callback function that takes a single pointer argument. The arg parameter specifies the argument.type can be any of the following: EV_SELECT0 or EV_SELECT -- Calls function when the event indicated by the dir parameter occurs in fd , a file descriptor.Of the two types, EV_SELECT0 is the one you typically specify. EV_SELECT0 specifies that the handler should be invoked only when there are no outstanding push/pop contexts. You should use EV_SELECT0 when the callback uses the routines OMpush_ctx/OMpop_ctx. Otherwise, you can use EV_SELECT. EV_SELECT specifies that the handler can be called in the middle of a push/pop context, but in this case, it should not begin a new context. EV_PRE0 or EV_PRE -- Calls function right before waiting for events. The fd and dir parameters have no meaning and should be set to 0.Of the two types, EV_PRE0 is the one you typically specify. EV_PRE0 specifies that the handler should be invoked only when there are no outstanding push/pop contexts. You should use EV_PRE0 when the callback creates its own push/pop context. Otherwise, you can use EV_PRE. EV_PRE specifies that the handler can be called in the middle of a push/pop context. EV_POST -- Calls function right after having waited for events. The fd and dir parameters have no meaning and should be set to 0. EV_POLL or EV_TIMEOUT -- Calls function when there are no events. EV_POLL calls the function immediately. EV_TIMEOUT calls the function after a certain number of milliseconds, which you specify with the dir parameter. The fd parameter has no meaning and should be set to 0. For EV_POLL, the dir parameter has no meaning and should be set to 0.EVdel_select deletes an event callback handler. The parameters to EVdel_select must match those of the EVadd_select that created the handler.

Arguments

type
An event type, as described above:EV_SELECT0EV_SELECTEV_PRE0EV_PREEV_POSTEV_POLLEV_TIMEOUT     
fd
A file descriptor. fd has meaning only when type is EV_SELECT0 or EV_SELECT. Otherwise, it should be 0.
function
A pointer to a user-supplied callback function. The function should take a single pointer argument.
NULL
The fourth argument should be NULL.
arg
The argument passed to function .
dir
When the type is EV_SELECT0 or EV_SELECT, a further refinement of the event type: EV_SEL_IN -- The event handler should be invoked when input data is available in fd . EV_SEL_OUT -- The event handler should be invoked when output can be sent to fd . EV_SEL_EX -- The event handler should be invoked when an exception has occurred in fd . When the type is EV_TIMEOUT, dir specifies the number of milliseconds to wait before invoking the event handler.For other types, dir has no meaning and should be 0.

Examples

none.

See Also

none.

TOC PREV NEXT INDEX