Ecore initialization, shutdown functions and reset on fork.

Functions

EAPI int ecore_init (void)
 Set up connections, signal handlers, sockets etc. More...
 
EAPI int ecore_shutdown (void)
 Shut down connections, signal handlers sockets etc. More...
 
EAPI Eina_Bool ecore_fork_reset_callback_add (Ecore_Cb func, const void *data)
 Add a function to be called by ecore_fork_reset() More...
 
EAPI Eina_Bool ecore_fork_reset_callback_del (Ecore_Cb func, const void *data)
 This removes the callback specified. More...
 
EAPI void ecore_fork_reset (void)
 Reset the ecore internal state after a fork. More...
 

Detailed Description

Function Documentation

EAPI void ecore_fork_reset ( void  )

Reset the ecore internal state after a fork.

Ecore maintains internal data that can be affected by the fork() system call which creates a duplicate of the current process. This also duplicates file descriptors which is problematic in that these file descriptors still point to their original sources. This function makes ecore reset internal state (e.g. pipes used for signalling between threads) so they function correctly afterwards.

It is highly suggested that you call this function after any fork() system call inside the child process if you intend to use ecore features after this point and not call any exec() family functions. Not doing so will cause possible misbehaviour.

Since
1.7

References ecore_pipe_add(), ecore_pipe_del(), and ecore_pipe_write().

EAPI Eina_Bool ecore_fork_reset_callback_add ( Ecore_Cb  func,
const void *  data 
)

Add a function to be called by ecore_fork_reset()

This queues func to be called (and passed data as its argument) when ecore_fork_reset() is called. This allows other libraries and subsystems to also reset their internal state after a fork.

Since
1.7

Referenced by ecore_evas_init().

EAPI Eina_Bool ecore_fork_reset_callback_del ( Ecore_Cb  func,
const void *  data 
)

This removes the callback specified.

This deletes the callback added by ecore_fork_reset_callback_add() using the function and data pointer to specify which to remove.

Since
1.7

Referenced by ecore_evas_shutdown().

EAPI int ecore_init ( void  )

Set up connections, signal handlers, sockets etc.

Returns
1 or greater on success, 0 otherwise

This function sets up all singal handlers and the basic event loop. If it succeeds, 1 will be returned, otherwise 0 will be returned.

1 #include <Ecore.h>
2 
3 int main(int argc, char **argv)
4 {
5  if (!ecore_init())
6  {
7  printf("ERROR: Cannot init Ecore!\n");
8  return -1;
9  }
10  ecore_main_loop_begin();
11  ecore_shutdown();
12 }
Examples:
ecore_con_client_example.c, ecore_con_client_simple_example.c, ecore_con_lookup_example.c, ecore_con_server_example.c, ecore_con_server_simple_example.c, ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, ecore_con_url_headers_example.c, ecore_event_example_01.c, ecore_event_example_02.c, ecore_exe_example.c, ecore_exe_example_child.c, ecore_fd_handler_example.c, ecore_fd_handler_gnutls_example.c, ecore_idler_example.c, ecore_job_example.c, ecore_pipe_gstreamer_example.c, ecore_pipe_simple_example.c, ecore_poller_example.c, ecore_thread_example.c, ecore_time_functions_example.c, and ecore_timer_example.c.

References ecore_animator_add(), and ecore_main_loop_glib_integrate().

Referenced by ecore_con_init(), ecore_evas_init(), ecore_file_init(), ecore_imf_init(), ecore_wl_init(), and ecore_x_init().

EAPI int ecore_shutdown ( void  )

Shut down connections, signal handlers sockets etc.

Returns
0 if ecore shuts down, greater than 0 otherwise. This function shuts down all things set up in ecore_init() and cleans up all event queues, handlers, filters, timers, idlers, idle enterers/exiters etc. set up after ecore_init() was called.

Do not call this function from any callback that may be called from the main loop, as the main loop will then fall over and not function properly.

Examples:
ecore_con_lookup_example.c, ecore_con_server_simple_example.c, ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, ecore_con_url_headers_example.c, ecore_event_example_02.c, ecore_exe_example.c, ecore_exe_example_child.c, ecore_fd_handler_example.c, ecore_idler_example.c, ecore_job_example.c, ecore_pipe_gstreamer_example.c, ecore_pipe_simple_example.c, ecore_poller_example.c, ecore_thread_example.c, ecore_time_functions_example.c, and ecore_timer_example.c.

Referenced by ecore_con_init(), ecore_con_shutdown(), ecore_evas_init(), ecore_evas_shutdown(), ecore_file_shutdown(), ecore_imf_init(), ecore_imf_shutdown(), ecore_wl_init(), and ecore_x_init().