yev_create_read_event()

yev_create_read_event()#

yev_create_read_event() creates a new read event associated with a given event loop, callback function, file descriptor, and buffer.

Prototype

yev_event_h yev_create_read_event(
    yev_loop_h      yev_loop,
    yev_callback_t  callback,
    hgobj           gobj,
    int            fd,
    gbuffer_t *    gbuf
);

Parameters

Key

Type

Description

yev_loop

yev_loop_h

The event loop handle in which the read event will be registered.

callback

yev_callback_t

The function to be called when the read event is triggered. If it returns -1, the loop in yev_loop_run() will break.

gobj

hgobj

The associated object that will handle the event.

fd

int

The file descriptor to monitor for read events.

gbuf

gbuffer_t *

The buffer where the read data will be stored.


Return Value

Returns a yev_event_h handle to the newly created read event, or NULL if the creation fails.

Notes

The event will be monitored for readability, and when data is available, the specified callback function will be invoked.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples