tibrvEvent_CreateIO()

Function

Declaration

tibrv_status tibrvEvent_CreateIO(
    tibrvEvent*            event,
    tibrvQueue             queue,
    tibrvEventCallback     callback,
    tibrv_i32              socketId,
    tibrvIOType            ioType,
    const void*            closure);

Purpose

Wait for specified I/O situations to occur.

Parameter

Description

event

For each I/O occurrence, place this event object on the event queue.

The program supplies a location, and the function stores the new event object in that location.

The event object remains valid until the program explicitly destroys it.

queue

For each I/O occurrence, place the event on this event queue.

callback

On dispatch, process the event with this callback function.

socketID

Wait for I/O occurrences on this socket.

ioType

Wait for I/O occurrences of this type.

See tibrvIOType.

closure

Store this closure data in the event object.

Activation and Dispatch

This function creates an event object that describes an I/O situation, and activates the event—that is, it requests notification from the operating system when that I/O situation occurs. When the situation occurs, Rendezvous software deactivates the event, and places the event object on its event queue. Dispatch removes the event object from the queue, and runs the callback function to process the event. When the callback function returns, Rendezvous software automatically reactivates the event. (To stop the cycle, destroy the event object; see tibrvEvent_Destroy().)

I/O Event Activation and Dispatch illustrates that Rendezvous software temporarily deactivates the I/O event from the time it enters the queue until its callback function returns. Consequently, an I/O object can cause at most one event at a time.

Figure 178: I/O Event Activation and Dispatch

Semantics of I/O Events

The semantics of all I/O conditions depend on the underlying operating system and event manager. Rendezvous software does not change those semantics.

I/O events trigger when the operating system reports that an I/O condition on a monitored socket would succeed (that is, transfer at least one byte without blocking). Nonetheless, Rendezvous software cannot guarantee that a subsequent I/O call will not block.

See Also

tibrvIOType

tibrvQueue