Ecore initialization, shutdown functions and reset on fork.

Typedefs

typedef struct _Ecore_Fork_Cb Ecore_Fork_Cb
 

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...
 

Variables

static int fork_cbs_walking = 0
 
static Eina_Listfork_cbs = NULL
 

Detailed Description

Function Documentation

§ ecore_init()

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.

#include <Ecore.h>
int main(int argc, char **argv)
{
if (!ecore_init())
{
printf("ERROR: Cannot init Ecore!\n");
return -1;
}
}
Examples:
banshee.c, client.c, complex-types-client-eina-value.c, complex-types-server.c, complex-types.c, connman-list-services.c, 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, ecore_timer_example.c, eina_tiler_01.c, eio_file_ls.c, ofono-dial.c, and server.c.

References eina_init(), eina_log_domain_register(), EINA_LOG_ERR, eina_prefix_new(), and evil_init().

Referenced by ecore_audio_init(), ecore_con_init(), ecore_evas_init(), ecore_file_init(), ecore_imf_init(), ecore_wl_init(), ecore_x_init(), edje_init(), eeze_init(), efreet_init(), efreet_mime_init(), eio_init(), and eldbus_init().

§ ecore_shutdown()

§ ecore_fork_reset_callback_add()

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

References EAPI, EINA_FALSE, eina_list_append(), and EINA_TRUE.

Referenced by ecore_evas_init().

§ ecore_fork_reset_callback_del()

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

References EAPI, EINA_FALSE, EINA_LIST_FOREACH, eina_list_remove_list(), and EINA_TRUE.

§ ecore_fork_reset()

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 EAPI, ecore_pipe_add(), ecore_pipe_del(), ecore_pipe_write(), EINA_LIST_FOREACH, EINA_LIST_FOREACH_SAFE, eina_list_remove_list(), and unsetenv().