File Event Handling Functions
Functions that deal with file descriptor handlers. More...
Functions | |
EAPI Ecore_Fd_Handler * | ecore_main_fd_handler_add (int fd, Ecore_Fd_Handler_Flags flags, int(*func)(void *data, Ecore_Fd_Handler *fd_handler), const void *data, int(*buf_func)(void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data) |
Adds a callback for activity on the given file descriptor. | |
EAPI void * | ecore_main_fd_handler_del (Ecore_Fd_Handler *fd_handler) |
Deletes the given FD handler. | |
EAPI int | ecore_main_fd_handler_fd_get (Ecore_Fd_Handler *fd_handler) |
Retrieves the file descriptor that the given handler is handling. | |
EAPI int | ecore_main_fd_handler_active_get (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Return if read, write or error, or a combination thereof, is active on the file descriptor of the given FD handler. | |
EAPI void | ecore_main_fd_handler_active_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Set what active streams the given FD handler should be monitoring. |
Detailed Description
Functions that deal with file descriptor handlers.
Function Documentation
EAPI int ecore_main_fd_handler_active_get | ( | Ecore_Fd_Handler * | fd_handler, | |
Ecore_Fd_Handler_Flags | flags | |||
) |
Return if read, write or error, or a combination thereof, is active on the file descriptor of the given FD handler.
- Parameters:
-
fd_handler The given FD handler. flags The flags, ECORE_FD_READ
,ECORE_FD_WRITE
orECORE_FD_ERROR
to query.
- Returns:
1
if any of the given flags are active.0
otherwise.
References ECORE_FD_ERROR, ECORE_FD_READ, and ECORE_FD_WRITE.
EAPI void ecore_main_fd_handler_active_set | ( | Ecore_Fd_Handler * | fd_handler, | |
Ecore_Fd_Handler_Flags | flags | |||
) |
Set what active streams the given FD handler should be monitoring.
- Parameters:
-
fd_handler The given FD handler. flags The flags to be watching.
Referenced by ecore_con_client_send(), ecore_con_server_send(), ecore_exe_pipe_run(), and ecore_exe_send().
EAPI Ecore_Fd_Handler* ecore_main_fd_handler_add | ( | int | fd, | |
Ecore_Fd_Handler_Flags | flags, | |||
int(*)(void *data, Ecore_Fd_Handler *fd_handler) | func, | |||
const void * | data, | |||
int(*)(void *buf_data, Ecore_Fd_Handler *fd_handler) | buf_func, | |||
const void * | buf_data | |||
) |
Adds a callback for activity on the given file descriptor.
func
will be called during the execution of ecore_main_loop_begin when the file descriptor is available for reading, or writing, or both.
Normally the return value from the func
is "zero means this handler is
finished and can be deleted" as is usual for handler callbacks. However, if the buf_func
is supplied, then the return value from the func
is "non zero means the handler should be called again in a tight loop".
buf_func
is called during event loop handling to check if data that has been read from the file descriptor is in a buffer and is available to read. Some systems (notably xlib) handle their own buffering, and would otherwise not work with select(). These systems should use a buf_func
. This is a most annoying hack, only ecore_x uses it, so refer to that for an example. NOTE - func
should probably return "one" always if buf_func
is used, to avoid confusion with the other return value semantics.
- Parameters:
-
fd The file descriptor to watch. flags To watch it for read ( ECORE_FD_READ
) and/or (ECORE_FD_WRITE
) write ability.ECORE_FD_ERROR
func The callback function. data The data to pass to the callback. buf_func The function to call to check if any data has been buffered and already read from the fd. Can be NULL
.buf_data The data to pass to the buf_func
function.
- Returns:
- A fd handler handle if successful.
NULL
otherwise.
Referenced by ecore_con_server_add(), ecore_con_server_connect(), ecore_evas_init(), ecore_exe_pipe_run(), ecore_pipe_add(), and ecore_x_init().
EAPI void* ecore_main_fd_handler_del | ( | Ecore_Fd_Handler * | fd_handler | ) |
Deletes the given FD handler.
- Parameters:
-
fd_handler The given FD handler.
- Returns:
- The data pointer set using ecore_main_fd_handler_add, for
fd_handler
on success.NULL
otherwise.
Referenced by ecore_con_client_del(), ecore_con_server_add(), ecore_con_server_connect(), ecore_con_server_del(), ecore_con_url_destroy(), ecore_evas_shutdown(), ecore_exe_free(), ecore_pipe_del(), and ecore_pipe_read_close().
EAPI int ecore_main_fd_handler_fd_get | ( | Ecore_Fd_Handler * | fd_handler | ) |
Retrieves the file descriptor that the given handler is handling.
- Parameters:
-
fd_handler The given FD handler.
- Returns:
- The file descriptor the handler is watching.