next up previous contents index
Next: 7.2.3 remove_listener: Disassociate a Up: 7.2 oskit_asyncio: Asynchronous I/O Previous: 7.2.1 poll: Poll for

7.2.2 add_listener: Associate a callback with this object

 

SYNOPSIS

#include <oskit/io/asyncio.h>

OSKIT_COMDECL oskit_asyncio_add_listener(oskit_asyncio_t *io, oskit_listener_t *l, oskit_s32_t mask);

DESCRIPTION

Add a callback listener object to handle asynchronous I/O events. When an event of interest occurs on this I/O object (i.e., when one of the one to three I/O conditions becomes true), all registered listeners will be called.

The mask parameter is an OR'ed combination of the OSKIT_ASYNCIO flags above. It specifies which events the listener is interested in. Note that spurious notifications are possible, the listener must use oskit_asyncio_poll to determine the actual state of affairs.

Also, if successful, this method returns a mask describing which of the OSKIT_ASYNCIO conditions are already true, which the caller must check in order to avoid missing events that occur just before the listener is registered.

PARAMETERS

io
The async I/O object.
l
The oskit_listener object to call.
mask
A mask of flags indicating which events are of interest.

RETURNS

If successful, returns a mask of the OSKIT_ASYNCIO currently pending. Otherwise, returns an error code specified in <oskit/error.h>.



Utah Flux Research Group