\hypertarget{group__Ecore__Init__Group}{\section{Ecore initialization, shutdown functions and reset on fork.}
\label{group__Ecore__Init__Group}\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Ecore__Init__Group_gac0e95e8f5e267a820c972ddda00b7483}{typedef struct \-\_\-\-Ecore\-\_\-\-Fork\-\_\-\-Cb {\bfseries Ecore\-\_\-\-Fork\-\_\-\-Cb}}\label{group__Ecore__Init__Group_gac0e95e8f5e267a820c972ddda00b7483}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} int \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\-\_\-init} (void)
\begin{DoxyCompactList}\small\item\em Set up connections, signal handlers, sockets etc. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} int \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\-\_\-shutdown} (void)
\begin{DoxyCompactList}\small\item\em Shut down connections, signal handlers sockets etc. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\-\_\-\-Bool} \hyperlink{group__Ecore__Init__Group_ga51ad1e8b9ad3fef5931d8bd372957bde}{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add} (\hyperlink{group__Ecore__Main__Loop__Group_ga00aa98b68b33de046b49a0158956874f}{Ecore\-\_\-\-Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Add a function to be called by \hyperlink{group__Ecore__Main__Loop__Group_gaadff0a56ba8818d8a35f9dc95e25a808}{ecore\-\_\-fork\-\_\-reset()} \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\-\_\-\-Bool} \hyperlink{group__Ecore__Init__Group_ga1eb6ddc9f5743026644b261ec99f79e1}{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del} (\hyperlink{group__Ecore__Main__Loop__Group_ga00aa98b68b33de046b49a0158956874f}{Ecore\-\_\-\-Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em This removes the callback specified. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} void \hyperlink{group__Ecore__Init__Group_ga65597db8fc0044bb7e86fe71d1313d74}{ecore\-\_\-fork\-\_\-reset} (void)
\begin{DoxyCompactList}\small\item\em Reset the ecore internal state after a fork. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Ecore__Init__Group_ga9a98ac826ab040d74eb6051bb4b54d8f}{static int {\bfseries fork\-\_\-cbs\-\_\-walking} = 0}\label{group__Ecore__Init__Group_ga9a98ac826ab040d74eb6051bb4b54d8f}

\item 
\hypertarget{group__Ecore__Init__Group_ga0f04e8bd179dab8b089b126df3e5c109}{static \hyperlink{group__Eina__List__Group_ga3295e1210efea1fb0fd6acbf3cbc1f29}{Eina\-\_\-\-List} $\ast$ {\bfseries fork\-\_\-cbs} = N\-U\-L\-L}\label{group__Ecore__Init__Group_ga0f04e8bd179dab8b089b126df3e5c109}

\end{DoxyCompactItemize}


\subsection{Detailed Description}


\subsection{Function Documentation}
\hypertarget{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}!ecore\-\_\-init@{ecore\-\_\-init}}
\index{ecore\-\_\-init@{ecore\-\_\-init}!Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
\subsubsection[{ecore\-\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}int ecore\-\_\-init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}


Set up connections, signal handlers, sockets etc. 

\begin{DoxyReturn}{Returns}
1 or greater on success, 0 otherwise
\end{DoxyReturn}
This function sets up all singal handlers and the basic event loop. If it succeeds, 1 will be returned, otherwise 0 will be returned.


\begin{DoxyCode}
\textcolor{preprocessor}{#include <Ecore.h>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
  \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}())
  \{
    printf(\textcolor{stringliteral}{"ERROR: Cannot init Ecore!\(\backslash\)n"});
    \textcolor{keywordflow}{return} -1;
  \}
  \hyperlink{group__Ecore__Main__Loop__Group_ga04daa7648a9d027bed25d27c150fdda7}{ecore\_main\_loop\_begin}();
  \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();
\}
\end{DoxyCode}
 \begin{Desc}
\item[Examples\-: ]\par
\hyperlink{banshee_8c-example}{banshee.\-c}, \hyperlink{client_8c-example}{client.\-c}, \hyperlink{complex-types-client-eina-value_8c-example}{complex-\/types-\/client-\/eina-\/value.\-c}, \hyperlink{complex-types-server_8c-example}{complex-\/types-\/server.\-c}, \hyperlink{complex-types_8c-example}{complex-\/types.\-c}, \hyperlink{connman-list-services_8c-example}{connman-\/list-\/services.\-c}, \hyperlink{ecore_con_client_example_8c-example}{ecore\-\_\-con\-\_\-client\-\_\-example.\-c}, \hyperlink{ecore_con_client_simple_example_8c-example}{ecore\-\_\-con\-\_\-client\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_con_lookup_example_8c-example}{ecore\-\_\-con\-\_\-lookup\-\_\-example.\-c}, \hyperlink{ecore_con_server_example_8c-example}{ecore\-\_\-con\-\_\-server\-\_\-example.\-c}, \hyperlink{ecore_con_server_simple_example_8c-example}{ecore\-\_\-con\-\_\-server\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_con_url_cookies_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-cookies\-\_\-example.\-c}, \hyperlink{ecore_con_url_download_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-download\-\_\-example.\-c}, \hyperlink{ecore_con_url_headers_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-headers\-\_\-example.\-c}, \hyperlink{ecore_event_example_01_8c-example}{ecore\-\_\-event\-\_\-example\-\_\-01.\-c}, \hyperlink{ecore_event_example_02_8c-example}{ecore\-\_\-event\-\_\-example\-\_\-02.\-c}, \hyperlink{ecore_exe_example_8c-example}{ecore\-\_\-exe\-\_\-example.\-c}, \hyperlink{ecore_exe_example_child_8c-example}{ecore\-\_\-exe\-\_\-example\-\_\-child.\-c}, \hyperlink{ecore_fd_handler_example_8c-example}{ecore\-\_\-fd\-\_\-handler\-\_\-example.\-c}, \hyperlink{ecore_fd_handler_gnutls_example_8c-example}{ecore\-\_\-fd\-\_\-handler\-\_\-gnutls\-\_\-example.\-c}, \hyperlink{ecore_idler_example_8c-example}{ecore\-\_\-idler\-\_\-example.\-c}, \hyperlink{ecore_job_example_8c-example}{ecore\-\_\-job\-\_\-example.\-c}, \hyperlink{ecore_pipe_gstreamer_example_8c-example}{ecore\-\_\-pipe\-\_\-gstreamer\-\_\-example.\-c}, \hyperlink{ecore_pipe_simple_example_8c-example}{ecore\-\_\-pipe\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_poller_example_8c-example}{ecore\-\_\-poller\-\_\-example.\-c}, \hyperlink{ecore_thread_example_8c-example}{ecore\-\_\-thread\-\_\-example.\-c}, \hyperlink{ecore_time_functions_example_8c-example}{ecore\-\_\-time\-\_\-functions\-\_\-example.\-c}, \hyperlink{ecore_timer_example_8c-example}{ecore\-\_\-timer\-\_\-example.\-c}, \hyperlink{eina_tiler_01_8c-example}{eina\-\_\-tiler\-\_\-01.\-c}, \hyperlink{eio_file_ls_8c-example}{eio\-\_\-file\-\_\-ls.\-c}, \hyperlink{ofono-dial_8c-example}{ofono-\/dial.\-c}, and \hyperlink{server_8c-example}{server.\-c}.\end{Desc}


References ecore\-\_\-animator\-\_\-add(), ecore\-\_\-main\-\_\-loop\-\_\-glib\-\_\-integrate(), ecore\-\_\-timer\-\_\-add(), eina\-\_\-init(), eina\-\_\-log\-\_\-domain\-\_\-register(), E\-I\-N\-A\-\_\-\-L\-O\-G\-\_\-\-E\-R\-R, eina\-\_\-log\-\_\-timing(), eina\-\_\-prefix\-\_\-new(), eina\-\_\-shutdown(), evil\-\_\-init(), evil\-\_\-shutdown(), and unsetenv().



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

\hypertarget{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}!ecore\-\_\-shutdown@{ecore\-\_\-shutdown}}
\index{ecore\-\_\-shutdown@{ecore\-\_\-shutdown}!Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
\subsubsection[{ecore\-\_\-shutdown}]{\setlength{\rightskip}{0pt plus 5cm}int ecore\-\_\-shutdown (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}


Shut down connections, signal handlers sockets etc. 

\begin{DoxyReturn}{Returns}
0 if ecore shuts down, greater than 0 otherwise. This function shuts down all things set up in \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\-\_\-init()} and cleans up all event queues, handlers, filters, timers, idlers, idle enterers/exiters etc. set up after \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\-\_\-init()} was called.
\end{DoxyReturn}
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. \begin{Desc}
\item[Examples\-: ]\par
\hyperlink{banshee_8c-example}{banshee.\-c}, \hyperlink{client_8c-example}{client.\-c}, \hyperlink{complex-types-client-eina-value_8c-example}{complex-\/types-\/client-\/eina-\/value.\-c}, \hyperlink{complex-types-server_8c-example}{complex-\/types-\/server.\-c}, \hyperlink{complex-types_8c-example}{complex-\/types.\-c}, \hyperlink{connman-list-services_8c-example}{connman-\/list-\/services.\-c}, \hyperlink{ecore_con_client_simple_example_8c-example}{ecore\-\_\-con\-\_\-client\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_con_lookup_example_8c-example}{ecore\-\_\-con\-\_\-lookup\-\_\-example.\-c}, \hyperlink{ecore_con_server_simple_example_8c-example}{ecore\-\_\-con\-\_\-server\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_con_url_cookies_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-cookies\-\_\-example.\-c}, \hyperlink{ecore_con_url_download_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-download\-\_\-example.\-c}, \hyperlink{ecore_con_url_headers_example_8c-example}{ecore\-\_\-con\-\_\-url\-\_\-headers\-\_\-example.\-c}, \hyperlink{ecore_event_example_02_8c-example}{ecore\-\_\-event\-\_\-example\-\_\-02.\-c}, \hyperlink{ecore_exe_example_8c-example}{ecore\-\_\-exe\-\_\-example.\-c}, \hyperlink{ecore_exe_example_child_8c-example}{ecore\-\_\-exe\-\_\-example\-\_\-child.\-c}, \hyperlink{ecore_fd_handler_example_8c-example}{ecore\-\_\-fd\-\_\-handler\-\_\-example.\-c}, \hyperlink{ecore_idler_example_8c-example}{ecore\-\_\-idler\-\_\-example.\-c}, \hyperlink{ecore_job_example_8c-example}{ecore\-\_\-job\-\_\-example.\-c}, \hyperlink{ecore_pipe_gstreamer_example_8c-example}{ecore\-\_\-pipe\-\_\-gstreamer\-\_\-example.\-c}, \hyperlink{ecore_pipe_simple_example_8c-example}{ecore\-\_\-pipe\-\_\-simple\-\_\-example.\-c}, \hyperlink{ecore_poller_example_8c-example}{ecore\-\_\-poller\-\_\-example.\-c}, \hyperlink{ecore_thread_example_8c-example}{ecore\-\_\-thread\-\_\-example.\-c}, \hyperlink{ecore_time_functions_example_8c-example}{ecore\-\_\-time\-\_\-functions\-\_\-example.\-c}, \hyperlink{ecore_timer_example_8c-example}{ecore\-\_\-timer\-\_\-example.\-c}, \hyperlink{eina_tiler_01_8c-example}{eina\-\_\-tiler\-\_\-01.\-c}, \hyperlink{eio_file_ls_8c-example}{eio\-\_\-file\-\_\-ls.\-c}, \hyperlink{ofono-dial_8c-example}{ofono-\/dial.\-c}, and \hyperlink{server_8c-example}{server.\-c}.\end{Desc}


References ecore\-\_\-timer\-\_\-del(), eina\-\_\-log\-\_\-domain\-\_\-unregister(), eina\-\_\-log\-\_\-timing(), eina\-\_\-prefix\-\_\-free(), eina\-\_\-shutdown(), and evil\-\_\-shutdown().



Referenced by ecore\-\_\-audio\-\_\-init(), ecore\-\_\-audio\-\_\-shutdown(), ecore\-\_\-con\-\_\-init(), ecore\-\_\-con\-\_\-shutdown(), ecore\-\_\-evas\-\_\-init(), ecore\-\_\-evas\-\_\-shutdown(), ecore\-\_\-file\-\_\-shutdown(), ecore\-\_\-imf\-\_\-init(), ecore\-\_\-imf\-\_\-shutdown(), ecore\-\_\-wl\-\_\-init(), ecore\-\_\-x\-\_\-init(), edje\-\_\-init(), eeze\-\_\-init(), eeze\-\_\-shutdown(), efreet\-\_\-init(), efreet\-\_\-mime\-\_\-init(), efreet\-\_\-mime\-\_\-shutdown(), efreet\-\_\-shutdown(), eio\-\_\-shutdown(), eldbus\-\_\-init(), and eldbus\-\_\-shutdown().

\hypertarget{group__Ecore__Init__Group_ga51ad1e8b9ad3fef5931d8bd372957bde}{\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}!ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add@{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add}}
\index{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add@{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add}!Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
\subsubsection[{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} {\bf Eina\-\_\-\-Bool} ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\-\_\-\-Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Init__Group_ga51ad1e8b9ad3fef5931d8bd372957bde}


Add a function to be called by \hyperlink{group__Ecore__Main__Loop__Group_gaadff0a56ba8818d8a35f9dc95e25a808}{ecore\-\_\-fork\-\_\-reset()} 

This queues {\ttfamily func} to be called (and passed {\ttfamily data} as its argument) when \hyperlink{group__Ecore__Main__Loop__Group_gaadff0a56ba8818d8a35f9dc95e25a808}{ecore\-\_\-fork\-\_\-reset()} is called. This allows other libraries and subsystems to also reset their internal state after a fork.

\begin{DoxySince}{Since}
1.\-7 
\end{DoxySince}


References E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E, eina\-\_\-list\-\_\-append(), and E\-I\-N\-A\-\_\-\-T\-R\-U\-E.



Referenced by ecore\-\_\-evas\-\_\-init().

\hypertarget{group__Ecore__Init__Group_ga1eb6ddc9f5743026644b261ec99f79e1}{\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}!ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del@{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del}}
\index{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del@{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del}!Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
\subsubsection[{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} {\bf Eina\-\_\-\-Bool} ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\-\_\-\-Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Init__Group_ga1eb6ddc9f5743026644b261ec99f79e1}


This removes the callback specified. 

This deletes the callback added by \hyperlink{group__Ecore__Main__Loop__Group_gad4c3bd5fb81af093ce3d64f6f8331043}{ecore\-\_\-fork\-\_\-reset\-\_\-callback\-\_\-add()} using the function and data pointer to specify which to remove.

\begin{DoxySince}{Since}
1.\-7 
\end{DoxySince}


References E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E, E\-I\-N\-A\-\_\-\-L\-I\-S\-T\-\_\-\-F\-O\-R\-E\-A\-C\-H, eina\-\_\-list\-\_\-remove\-\_\-list(), and E\-I\-N\-A\-\_\-\-T\-R\-U\-E.



Referenced by ecore\-\_\-evas\-\_\-shutdown().

\hypertarget{group__Ecore__Init__Group_ga65597db8fc0044bb7e86fe71d1313d74}{\index{Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}!ecore\-\_\-fork\-\_\-reset@{ecore\-\_\-fork\-\_\-reset}}
\index{ecore\-\_\-fork\-\_\-reset@{ecore\-\_\-fork\-\_\-reset}!Ecore initialization, shutdown functions and reset on fork.@{Ecore initialization, shutdown functions and reset on fork.}}
\subsubsection[{ecore\-\_\-fork\-\_\-reset}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} void ecore\-\_\-fork\-\_\-reset (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Init__Group_ga65597db8fc0044bb7e86fe71d1313d74}


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.

\begin{DoxySince}{Since}
1.\-7 
\end{DoxySince}


References ecore\-\_\-pipe\-\_\-add(), ecore\-\_\-pipe\-\_\-del(), ecore\-\_\-pipe\-\_\-write(), E\-I\-N\-A\-\_\-\-L\-I\-S\-T\-\_\-\-F\-O\-R\-E\-A\-C\-H, E\-I\-N\-A\-\_\-\-L\-I\-S\-T\-\_\-\-F\-O\-R\-E\-A\-C\-H\-\_\-\-S\-A\-F\-E, eina\-\_\-list\-\_\-remove\-\_\-list(), and unsetenv().

