Loop_Group Ecore Main Loop functions

Functions

EAPI void ecore_main_loop_iterate (void)
 Runs a single iteration of the main loop to process everything on the queue.
EAPI void ecore_main_loop_select_func_set (Ecore_Select_Function func)
 Sets the function to use when monitoring multiple file descriptors, and waiting until one of more of the file descriptors before ready for some class of I/O operation.
EAPI Ecore_Select_Function ecore_main_loop_select_func_get (void)
 Gets the select function set by ecore_select_func_set(), or the native select function if none was set.
EAPI Eina_Bool ecore_main_loop_glib_integrate (void)
 Request ecore to integrate GLib's main loop.
EAPI void ecore_main_loop_glib_always_integrate_disable (void)
 Disable always integrating glib.
EAPI void ecore_main_loop_begin (void)
 Runs the application main loop.
EAPI void ecore_main_loop_quit (void)
 Quits the main loop once all the events currently on the queue have been processed.
EAPI Ecore_Fd_Handlerecore_main_fd_handler_add (int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data)
 Adds a callback for activity on the given file descriptor.
EAPI void ecore_main_fd_handler_prepare_callback_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data)
 Set the prepare callback with data for a given Ecore_Fd_Handler.
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 Eina_Bool 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.

Function Documentation

EAPI Eina_Bool 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_handlerThe given FD handler.
flagsThe flags, ECORE_FD_READ, ECORE_FD_WRITE or ECORE_FD_ERROR to query.
Returns:
#EINA_TRUE if any of the given flags are active. #EINA_FALSE 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_handlerThe given FD handler.
flagsThe 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,
Ecore_Fd_Cb  func,
const void *  data,
Ecore_Fd_Cb  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:
fdThe file descriptor to watch.
flagsTo watch it for read (ECORE_FD_READ) and/or (ECORE_FD_WRITE) write ability. ECORE_FD_ERROR
funcThe callback function.
dataThe data to pass to the callback.
buf_funcThe function to call to check if any data has been buffered and already read from the fd. Can be NULL.
buf_dataThe data to pass to the buf_func function.
Returns:
A fd handler handle if successful. NULL otherwise.

Referenced by ecore_evas_init(), ecore_exe_pipe_run(), ecore_fb_input_device_listen(), 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_handlerThe given FD handler.
Returns:
The data pointer set using ecore_main_fd_handler_add, for fd_handler on success. NULL otherwise.

Beware that if the fd is already closed, ecore may complain if it uses epoll internally, and that in some rare cases this may be able to cause crashes and instability. Remember to delete your fd handlers before the fd's they listen to are closed.

Referenced by ecore_con_client_del(), ecore_con_server_add(), ecore_con_server_connect(), ecore_con_server_del(), ecore_con_url_free(), 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_handlerThe given FD handler.
Returns:
The file descriptor the handler is watching.
EAPI void ecore_main_fd_handler_prepare_callback_set ( Ecore_Fd_Handler fd_handler,
Ecore_Fd_Prep_Cb  func,
const void *  data 
)

Set the prepare callback with data for a given Ecore_Fd_Handler.

Parameters:
fd_handlerThe fd handler
funcThe prep function
dataThe data to pass to the prep function This function will be called prior to the the fd handler's callback function.
EAPI void ecore_main_loop_begin ( void  )

Runs the application main loop.

This function will not return until ecore_main_loop_quit is called.

Examples:
ecore_con_client_example.c, and ecore_con_server_example.c.
EAPI void ecore_main_loop_glib_always_integrate_disable ( void  )

Disable always integrating glib.

If ecore is compiled with --enable-glib-integration-always (to always call ecore_main_loop_glib_integrate() when ecore_init() is called), then calling this before calling ecore_init() will disable the integration. This is for apps that explicitly do not want this to happen for whatever reasons they may have.

EAPI Eina_Bool ecore_main_loop_glib_integrate ( void  )

Request ecore to integrate GLib's main loop.

This will add a small overhead during every main loop interaction by checking glib's default main context (used by its main loop). If it have events to be checked (timers, file descriptors or idlers), then these will be polled alongside with Ecore's own events, then dispatched before Ecore's. This is done by calling ecore_main_loop_select_func_set().

This will cooperate with previously set ecore_main_loop_select_func_set() by calling the old function. Similarly, if you want to override ecore_main_loop_select_func_set() after main loop is integrated, call the new select function set by this call (get it by calling ecore_main_loop_select_func_get() right after ecore_main_loop_glib_integrate()).

This is useful to use GMainLoop libraries, like GTK, GUPnP, LibSoup, GConf and more. Adobe Flash plugin and other plugins systems depend on this as well.

Once initialized/integrated, it will be valid until Ecore is completely shut down.

Note:
this is only available if Ecore was compiled with GLib support.
Returns:
EINA_TRUE on success of EINA_FALSE if it failed, likely no GLib support in Ecore.

References ecore_main_loop_select_func_get(), and ecore_main_loop_select_func_set().

Referenced by ecore_init().

EAPI void ecore_main_loop_select_func_set ( Ecore_Select_Function  func)

Sets the function to use when monitoring multiple file descriptors, and waiting until one of more of the file descriptors before ready for some class of I/O operation.

This function will be used instead of the system call select and could possible be used to integrate the Ecore event loop with an external event loop.

Warning:
you don't know how to use, don't even try to use it.

Referenced by ecore_main_loop_glib_integrate().