\hypertarget{ecore_job_example_8c-example}{}\section{ecore\+\_\+job\+\_\+example.\+c}
This example shows how to use an \hyperlink{group__Ecore__Job__Group_ga2942e879ec428e9f5156a4ba688217ed}{Ecore\+\_\+\+Job}. See \hyperlink{ecore_job_example_c}{the explanation here}.


\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o ecore\_job\_example ecore\_job\_example.c `pkg-config --libs --cflags ecore`}

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

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_job\_print\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keywordtype}{char} *str = data;

   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, str);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_job\_quit\_cb(\textcolor{keywordtype}{void} *data \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED})
\{
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \hyperlink{group__Ecore__Job__Group_ga2942e879ec428e9f5156a4ba688217ed}{Ecore\_Job} *job1, *job2, *job3, *job\_quit;
   \textcolor{keywordtype}{char} *str1 = \textcolor{stringliteral}{"Job 1 started."};
   \textcolor{keywordtype}{char} *str2 = \textcolor{stringliteral}{"Job 2 started."};
   \textcolor{keywordtype}{char} *str3 = \textcolor{stringliteral}{"Job 3 started."};

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}())
     \{
        printf(\textcolor{stringliteral}{"ERROR: Cannot init Ecore!\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   job1 = \hyperlink{group__Ecore__Job__Group_ga0f9f52dc3b3afad5cea1b5924f432b83}{ecore\_job\_add}(\_job\_print\_cb, str1);
   job2 = \hyperlink{group__Ecore__Job__Group_ga0f9f52dc3b3afad5cea1b5924f432b83}{ecore\_job\_add}(\_job\_print\_cb, str2);
   job3 = \hyperlink{group__Ecore__Job__Group_ga0f9f52dc3b3afad5cea1b5924f432b83}{ecore\_job\_add}(\_job\_print\_cb, str3);

   job\_quit = \hyperlink{group__Ecore__Job__Group_ga0f9f52dc3b3afad5cea1b5924f432b83}{ecore\_job\_add}(\_job\_quit\_cb, NULL);

   (void)job1;
   (void)job3;
   (void)job\_quit;

   printf(\textcolor{stringliteral}{"Created jobs 1, 2, 3 and quit.\(\backslash\)n"});

   \textcolor{keywordflow}{if} (job2)
     \{
        \textcolor{keywordtype}{char} *str;
        str = \hyperlink{group__Ecore__Job__Group_ga0fe8d42a1b07963b48d7bb175ee39558}{ecore\_job\_del}(job2);
        job2 = NULL;
        printf(\textcolor{stringliteral}{"Deleted job 2. Its data was: \(\backslash\)"%s\(\backslash\)"\(\backslash\)n"}, str);
     \}

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();
   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}

\end{DoxyCodeInclude}
 