forked from enlightenment/efl
Be able to change select() function used by main loop.
Patch by Kenneth Christiansen, used to integrate with GLib and other main loops. SVN revision: 40110
This commit is contained in:
parent
18493b6d1b
commit
852c598be4
|
@ -278,6 +278,10 @@ extern "C" {
|
|||
EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
|
||||
|
||||
EAPI void ecore_main_loop_iterate(void);
|
||||
|
||||
EAPI void ecore_main_loop_select_func_set(int (*func)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout));
|
||||
EAPI void *ecore_main_loop_select_func_get(void);
|
||||
|
||||
EAPI void ecore_main_loop_begin(void);
|
||||
EAPI void ecore_main_loop_quit(void);
|
||||
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);
|
||||
|
|
|
@ -47,6 +47,7 @@ static int in_main_loop = 0;
|
|||
static int do_quit = 0;
|
||||
static Ecore_Fd_Handler *fd_handlers = NULL;
|
||||
static int fd_handlers_delete_me = 0;
|
||||
static int (*main_loop_select)(int , fd_set *, fd_set *, fd_set *, struct timeval *) = select;
|
||||
|
||||
static double t1 = 0.0;
|
||||
static double t2 = 0.0;
|
||||
|
@ -109,6 +110,37 @@ ecore_main_loop_quit(void)
|
|||
do_quit = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @ingroup Ecore_Main_Loop_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_main_loop_select_func_set(int (*func)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout))
|
||||
{
|
||||
main_loop_select = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select function set by ecore_select_func_set(),
|
||||
* or the native select function if none was set.
|
||||
*
|
||||
* @ingroup Ecore_Main_Loop_Group
|
||||
*/
|
||||
EAPI void *
|
||||
ecore_main_loop_select_func_get(void)
|
||||
{
|
||||
return main_loop_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_FD_Handler_Group File Event Handling Functions
|
||||
*
|
||||
|
@ -361,7 +393,7 @@ _ecore_main_select(double timeout)
|
|||
}
|
||||
if (_ecore_signal_count_get()) return -1;
|
||||
|
||||
ret = select(max_fd + 1, &rfds, &wfds, &exfds, t);
|
||||
ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t);
|
||||
_ecore_loop_time = ecore_time_get();
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue