\hypertarget{ecore_thread_example_8c-example}{}\section{ecore\+\_\+thread\+\_\+example.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{/*}
\textcolor{comment}{ * gcc -o ecore\_thread\_example ecore\_thread\_example.c `pkg-config --cflags --libs ecore eina`}
\textcolor{comment}{ */}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <\hyperlink{dirent_8h}{dirent.h}>}
\textcolor{preprocessor}{#include <unistd.h>}

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

\textcolor{keyword}{typedef} \textcolor{keyword}{struct}
\{
   \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread}  *thread\_3;
   \textcolor{keywordtype}{int}            msgs\_received;
   \textcolor{keywordtype}{int}            max\_msgs;
   Eina\_Lock      mutex;
   Eina\_Condition condition;
\} App\_Data;

\textcolor{keyword}{typedef} \textcolor{keyword}{struct}
\{
   \hyperlink{struct__Eina__List}{Eina\_List} *list;
\} Thread\_Data;

\textcolor{keyword}{typedef} \textcolor{keyword}{struct}
\{
   \textcolor{keywordtype}{char}     *name;
   \textcolor{keywordtype}{char}     *base;
   Eina\_Lock mutex;
\} Feedback\_Thread\_Data;

\textcolor{keyword}{typedef} \textcolor{keyword}{struct}
\{
   \textcolor{keywordtype}{int}        all\_done;
   \hyperlink{struct__Eina__List}{Eina\_List} *list;
\} App\_Msg;

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_local\_data\_free(\textcolor{keywordtype}{void} *data)
\{
   Thread\_Data *td = data;
   \textcolor{keywordtype}{char} *str;

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(td->list, str)
     \{
        printf(\textcolor{stringliteral}{"Freeing string: %s\(\backslash\)n"}, str);
        free(str);
     \}
   free(td);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_short\_job(\textcolor{keywordtype}{void} *data \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th)
\{
   Thread\_Data *td;
   \textcolor{keywordtype}{int} i;

   td = \hyperlink{group__Ecore__Thread__Group_ga1a937d674f1a20162b31b95d0ed100ad}{ecore\_thread\_local\_data\_find}(th, \textcolor{stringliteral}{"data"});
   \textcolor{keywordflow}{if} (!td)
     \{
        td = calloc(1, \textcolor{keyword}{sizeof}(Thread\_Data));
        \textcolor{keywordflow}{if} (!td)
          \{
             \hyperlink{group__Ecore__Thread__Group_gae9b9b20e1ed53c62c51617b55aed2511}{ecore\_thread\_cancel}(th);
             \textcolor{keywordflow}{return};
          \}
        \hyperlink{group__Ecore__Thread__Group_ga6878f550a9bcc8002c0c709b4b4dca66}{ecore\_thread\_local\_data\_add}(th, \textcolor{stringliteral}{"data"}, td, \_local\_data\_free,
                                    \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
     \}

   \textcolor{keywordflow}{for} (i = 0; i < 10; i++)
     \{
        \textcolor{keywordtype}{char} buf[200];

        \textcolor{keywordflow}{if} (\hyperlink{group__Ecore__Thread__Group_ga792471a7ed00718b71d58b791ddbd08d}{ecore\_thread\_check}(th))
          \{
             \hyperlink{group__Ecore__Thread__Group_gad3c1d51a24772b885b26486be86c2779}{ecore\_thread\_local\_data\_del}(th, \textcolor{stringliteral}{"data"});
             \textcolor{keywordflow}{break};
          \}

        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"Thread %p: String number %d"}, th, i);
        td->list = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(td->list, strdup(buf));
        sleep(1);
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_feedback\_job(\textcolor{keywordtype}{void} *data \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th)
\{
   time\_t t;
   \textcolor{keywordtype}{int} i, count;
   Feedback\_Thread\_Data *ftd = NULL;
\textcolor{preprocessor}{#ifdef \_WIN32}
   HANDLE h;
   WIN32\_FIND\_DATA fd;
\textcolor{preprocessor}{#else}
   \hyperlink{group__Evil__Dirent__Group_ga49eb6ac4643553d04b85c70646c6786d}{DIR} *dir;
\textcolor{preprocessor}{#endif}
   App\_Msg *msg;

   count = (int)(uintptr\_t)\hyperlink{group__Ecore__Thread__Group_ga011eeb2f99aaa950089ddc6ea989da29}{ecore\_thread\_global\_data\_find}(\textcolor{stringliteral}{"count"});
   \textcolor{keywordflow}{for} (i = 0; i < count; i++)
     \{
        \textcolor{keywordtype}{char} buf[32];
        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"data%d"}, i);
        ftd = \hyperlink{group__Ecore__Thread__Group_ga011eeb2f99aaa950089ddc6ea989da29}{ecore\_thread\_global\_data\_find}(buf);
        \textcolor{keywordflow}{if} (!ftd)
          \textcolor{keywordflow}{continue};
        \textcolor{keywordflow}{if} (\hyperlink{group__Eina__Lock__Group_ga13c8270c1589bfd4770ee4cd43977bc5}{eina\_lock\_take\_try}(&ftd->mutex))
          \textcolor{keywordflow}{break};
        \textcolor{keywordflow}{else}
          ftd = NULL;
     \}
   \textcolor{keywordflow}{if} (!ftd)
     \textcolor{keywordflow}{return};

\textcolor{preprocessor}{#ifdef \_WIN32}
   h = FindFirstFile(ftd->base, &fd);
   \textcolor{keywordflow}{if} (h == INVALID\_HANDLE\_VALUE)
     \textcolor{keywordflow}{goto} the\_end;
\textcolor{preprocessor}{#else}
   dir = \hyperlink{group__Evil__Dirent__Group_ga0bfba238260bb94aa679f4aa63ec5e16}{opendir}(ftd->base);
   \textcolor{keywordflow}{if} (!dir)
     \textcolor{keywordflow}{goto} the\_end;
\textcolor{preprocessor}{#endif}

   msg = calloc(1, \textcolor{keyword}{sizeof}(App\_Msg));

   t = time(NULL);
   \textcolor{keywordflow}{while} (time(NULL) < t + 2)
     \{
\textcolor{preprocessor}{#ifdef \_WIN32}
        \textcolor{keywordflow}{if} (strlen(fd.cFileName) >= 10)
          msg->list = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(msg->list,
                                       strdup(fd.cFileName));
        FindNextFile(h, &fd);
\textcolor{preprocessor}{#else}
        \textcolor{keyword}{struct }\hyperlink{structdirent}{dirent} entry, *result;

        \textcolor{keywordflow}{if} (readdir\_r(dir, &entry, &result))
          \textcolor{keywordflow}{break};
        \textcolor{keywordflow}{if} (!result)
          \textcolor{keywordflow}{break};

        \textcolor{keywordflow}{if} (strlen(result->\hyperlink{structdirent_a3a1b19d864bfcb427dc05410c1a64721}{d\_name}) >= 10)
          msg->list = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(msg->list,
                                       strdup(result->\hyperlink{structdirent_a3a1b19d864bfcb427dc05410c1a64721}{d\_name}));
\textcolor{preprocessor}{#endif}
     \}

\textcolor{preprocessor}{#ifdef \_WIN32}
   FindClose(h);
\textcolor{preprocessor}{#else}
   \hyperlink{group__Evil__Dirent__Group_ga37224cbfdf13ef346f90407253dedcbe}{closedir}(dir);
\textcolor{preprocessor}{#endif}
   \hyperlink{group__Ecore__Thread__Group_ga8fadd19caae011ab1483665f09ce4d91}{ecore\_thread\_feedback}(th, msg);

the\_end:
   \hyperlink{group__Ecore__Thread__Group_ga8e53feb974331550744cbc2e40dc9132}{ecore\_thread\_global\_data\_del}(ftd->name);
   free(ftd->name);
   free(ftd->base);
   \hyperlink{group__Eina__Lock__Group_ga469476cfe8d8ca4dfdc46469fb9e31e5}{eina\_lock\_release}(&ftd->mutex);
   \hyperlink{group__Eina__Lock__Group_gaf8d1c4e3aff3bd26fc85d81ed8c4e71a}{eina\_lock\_free}(&ftd->mutex);
   free(ftd);
   \hyperlink{group__Ecore__Thread__Group_gadf825c1a58f06bba2a304d025bed3185}{ecore\_thread\_reschedule}(th);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_out\_of\_pool\_job(\textcolor{keywordtype}{void} *data, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th)
\{
   App\_Data *ad = data;
   App\_Msg *msg;

   \textcolor{keywordflow}{while} (1)
     \{
        \textcolor{keywordtype}{int} msgs;
        \hyperlink{group__Eina__Lock__Group_ga149f387d5f18c469c365147ffbd4dc2c}{eina\_condition\_wait}(&ad->condition);
        msgs = ad->msgs\_received;
        \hyperlink{group__Eina__Lock__Group_ga469476cfe8d8ca4dfdc46469fb9e31e5}{eina\_lock\_release}(&ad->mutex);
        \textcolor{keywordflow}{if} (msgs == ad->max\_msgs)
          \{
             msg = calloc(1, \textcolor{keyword}{sizeof}(App\_Msg));
             msg->all\_done = 1;
             \hyperlink{group__Ecore__Thread__Group_ga8fadd19caae011ab1483665f09ce4d91}{ecore\_thread\_feedback}(th, msg);
             \textcolor{keywordflow}{return};
          \}
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_print\_status(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{int} active, pending\_total, pending\_feedback, pending\_short, available;

   active = \hyperlink{group__Ecore__Thread__Group_gad7a28588dc26d6af8b6db8abc3ef37ce}{ecore\_thread\_active\_get}();
   pending\_total = \hyperlink{group__Ecore__Thread__Group_gaeaa014287d578a200d41cca861bceac3}{ecore\_thread\_pending\_total\_get}();
   pending\_feedback = \hyperlink{group__Ecore__Thread__Group_gaa5c56445198f7b03c1f080039499689a}{ecore\_thread\_pending\_feedback\_get}();
   pending\_short = \hyperlink{group__Ecore__Thread__Group_ga3e32f650cfe811e69bba7825c71b9070}{ecore\_thread\_pending\_get}();
   available = \hyperlink{group__Ecore__Thread__Group_ga6e7703b3013d9c872449f6e2ec093b53}{ecore\_thread\_available\_get}();

   printf(\textcolor{stringliteral}{"Status:\(\backslash\)n\(\backslash\)t* Active threads: %d\(\backslash\)n"}
          \textcolor{stringliteral}{"\(\backslash\)t* Available threads: %d\(\backslash\)n"}
          \textcolor{stringliteral}{"\(\backslash\)t* Pending short jobs: %d\(\backslash\)n"}
          \textcolor{stringliteral}{"\(\backslash\)t* Pending feedback jobs: %d\(\backslash\)n"}
          \textcolor{stringliteral}{"\(\backslash\)t* Pending total: %d\(\backslash\)n"}, active, available, pending\_short,
          pending\_feedback, pending\_total);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_feedback\_job\_msg\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th, \textcolor{keywordtype}{void} *msg\_data)
\{
   App\_Data *ad = data;
   App\_Msg *msg = msg\_data;
   \textcolor{keywordtype}{char} *str;

   \textcolor{keywordflow}{if} (msg->all\_done)
     \{
        \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
        free(msg);
        \textcolor{keywordflow}{return};
     \}

   \_print\_status();

   \textcolor{keywordflow}{if} (!msg->list)
     printf(\textcolor{stringliteral}{"Received an empty list from thread %p\(\backslash\)n"}, th);
   \textcolor{keywordflow}{else}
     \{
        \textcolor{keywordtype}{int} i = 0;
        printf(\textcolor{stringliteral}{"Received %d elements from threads %p (printing first 5):\(\backslash\)n"},
               \hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(msg->list), th);
        \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(msg->list, str)
          \{
             \textcolor{keywordflow}{if} (i <= 5)
               printf(\textcolor{stringliteral}{"\(\backslash\)t%s\(\backslash\)n"}, str);
             free(str);
             i++;
          \}
     \}

   \hyperlink{group__Eina__Lock__Group_ga2ad27b83cf8562a41fe67557d8d2d753}{eina\_lock\_take}(&ad->mutex);
   ad->msgs\_received++;
   \hyperlink{group__Eina__Lock__Group_ga42cfdc4920e74fd7ba99527a6a99cd7d}{eina\_condition\_signal}(&ad->condition);
   \hyperlink{group__Eina__Lock__Group_ga469476cfe8d8ca4dfdc46469fb9e31e5}{eina\_lock\_release}(&ad->mutex);

   free(msg);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_thread\_end\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th)
\{
   App\_Data *ad = data;

   printf(\textcolor{stringliteral}{"Normal termination for thread %p.\(\backslash\)n"}, th);
   \textcolor{keywordflow}{if} (th == ad->thread\_3)
     ad->thread\_3 = NULL;
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_thread\_cancel\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__Ecore__Thread__Group_ga0c2e1f8d562ccf80ecc0009ada72496f}{Ecore\_Thread} *th)
\{
   App\_Data *ad = data;

   printf(\textcolor{stringliteral}{"Thread %p got cancelled.\(\backslash\)n"}, th);
   \textcolor{keywordflow}{if} (th == ad->thread\_3)
     ad->thread\_3 = NULL;
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_cancel\_timer\_cb(\textcolor{keywordtype}{void} *data)
\{
   App\_Data *ad = data;

   \textcolor{keywordflow}{if} (ad->thread\_3 && !\hyperlink{group__Ecore__Thread__Group_ga792471a7ed00718b71d58b791ddbd08d}{ecore\_thread\_check}(ad->thread\_3))
     \hyperlink{group__Ecore__Thread__Group_gae9b9b20e1ed53c62c51617b55aed2511}{ecore\_thread\_cancel}(ad->thread\_3);

   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_status\_timer\_cb(\textcolor{keywordtype}{void} *data \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED})
\{
   \_print\_status();

   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
\}

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Ecore__Getopt}{Ecore\_Getopt} optdesc = \{
   \textcolor{stringliteral}{"ecore\_thread\_example"},
   NULL,
   \textcolor{stringliteral}{"0.0"},
   \textcolor{stringliteral}{"(C) 2011 Enlightenment"},
   \textcolor{stringliteral}{"Public domain?"},
   \textcolor{stringliteral}{"Example program for Ecore\_Thread"},
   0,
   \{
      \hyperlink{group__Ecore__Getopt__Group_gae2ee4724bff2a0cf9acdbdbb74351745}{ECORE\_GETOPT\_STORE\_INT}(\textcolor{charliteral}{'t'}, \textcolor{stringliteral}{"threads"}, \textcolor{stringliteral}{"Max number of threads to run"}),
      \hyperlink{group__Ecore__Getopt__Group_gae2ee4724bff2a0cf9acdbdbb74351745}{ECORE\_GETOPT\_STORE\_INT}(\textcolor{charliteral}{'m'}, \textcolor{stringliteral}{"msgs"}, \textcolor{stringliteral}{"Max number of messages to receive"}),
      \hyperlink{group__Ecore__Getopt__Group_ga74964c89c7676b39623ea3759dbcc39c}{ECORE\_GETOPT\_APPEND\_METAVAR}(\textcolor{charliteral}{'p'}, \textcolor{stringliteral}{"path"}, \textcolor{stringliteral}{"Add path for feedback job"},
                                  \textcolor{stringliteral}{"STRING"}, \hyperlink{group__Ecore__Getopt__Group_ggad117da080da25f6a67b500d94d0f6636a395a02cca379ddcf1f55cc539c134515}{ECORE\_GETOPT\_TYPE\_STR}),
      \hyperlink{group__Ecore__Getopt__Group_gad7e09a56d2881f22d69dff005e38b67d}{ECORE\_GETOPT\_HELP}(\textcolor{charliteral}{'h'}, \textcolor{stringliteral}{"help"}),
      \hyperlink{group__Ecore__Getopt__Group_gaf652ac6007cd9674df603fa3dacc59e0}{ECORE\_GETOPT\_SENTINEL}
   \}
\};

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])
\{
   \textcolor{keywordtype}{int} i, max\_threads = 0, max\_msgs = 0;
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} opt\_quit = \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
   \hyperlink{struct__Eina__List}{Eina\_List} *path\_list = NULL;
   App\_Data appdata;
   \hyperlink{union__Ecore__Getopt__Value}{Ecore\_Getopt\_Value} values[] = \{
      \hyperlink{group__Ecore__Getopt__Group_ga048498f4546a0dd78c541168db62494e}{ECORE\_GETOPT\_VALUE\_INT}(max\_threads),
      \hyperlink{group__Ecore__Getopt__Group_ga048498f4546a0dd78c541168db62494e}{ECORE\_GETOPT\_VALUE\_INT}(max\_msgs),
      \hyperlink{group__Ecore__Getopt__Group_ga0ad194cc9e30633ee01068ed4cc72edc}{ECORE\_GETOPT\_VALUE\_LIST}(path\_list),
      \hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}(opt\_quit),
      \hyperlink{group__Ecore__Getopt__Group_ga0440d57be0af2a77dc5de02be19aeae2}{ECORE\_GETOPT\_VALUE\_NONE}
   \};

   \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}();

   i = \hyperlink{group__Ecore__Thread__Group_gabad7972818b7fb1346ae7a098cd47220}{ecore\_thread\_max\_get}();
   printf(\textcolor{stringliteral}{"Initial max threads: %d\(\backslash\)n"}, i);

   memset(&appdata, 0, \textcolor{keyword}{sizeof}(App\_Data));
   appdata.max\_msgs = 1;

   \textcolor{keywordflow}{if} (\hyperlink{group__Ecore__Getopt__Group_gab9fb5bf2f2edd9bd3a3519faa8e3ebfa}{ecore\_getopt\_parse}(&optdesc, values, argc, argv) < 0)
     \{
        printf(\textcolor{stringliteral}{"Argument parsing failed\(\backslash\)n"});
        \textcolor{keywordflow}{return} 1;
     \}

   \textcolor{keywordflow}{if} (opt\_quit)
     \textcolor{keywordflow}{return} 0;

   \textcolor{keywordflow}{if} (max\_threads)
     \{
        \hyperlink{group__Ecore__Thread__Group_gaaf965a46e0cc12857883806812af7693}{ecore\_thread\_max\_set}(max\_threads);
        printf(\textcolor{stringliteral}{"Max threads: %d\(\backslash\)n"}, \hyperlink{group__Ecore__Thread__Group_gabad7972818b7fb1346ae7a098cd47220}{ecore\_thread\_max\_get}());
     \}
   \textcolor{keywordflow}{if} (max\_msgs)
     appdata.max\_msgs = max\_msgs;

   \textcolor{keywordflow}{if} (!path\_list)
     \{
        Feedback\_Thread\_Data *ftd;
        \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(\textcolor{stringliteral}{"count"}, (\textcolor{keywordtype}{void} *)3, NULL, 
      \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        ftd = calloc(1, \textcolor{keyword}{sizeof}(Feedback\_Thread\_Data));
        ftd->name = strdup(\textcolor{stringliteral}{"data0"});
        ftd->base = strdup(\textcolor{stringliteral}{"/usr/bin"});
        \hyperlink{group__Eina__Lock__Group_ga8dda398c1db315582a80640c7f78f648}{eina\_lock\_new}(&ftd->mutex);
        \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(ftd->name, ftd, NULL, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        ftd = calloc(1, \textcolor{keyword}{sizeof}(Feedback\_Thread\_Data));
        ftd->name = strdup(\textcolor{stringliteral}{"data1"});
        ftd->base = strdup(\textcolor{stringliteral}{"/usr/lib"});
        \hyperlink{group__Eina__Lock__Group_ga8dda398c1db315582a80640c7f78f648}{eina\_lock\_new}(&ftd->mutex);
        \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(ftd->name, ftd, NULL, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        ftd = calloc(1, \textcolor{keyword}{sizeof}(Feedback\_Thread\_Data));
        ftd->name = strdup(\textcolor{stringliteral}{"data2"});
        ftd->base = strdup(\textcolor{stringliteral}{"/usr/share"});
        \hyperlink{group__Eina__Lock__Group_ga8dda398c1db315582a80640c7f78f648}{eina\_lock\_new}(&ftd->mutex);
        \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(ftd->name, ftd, NULL, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
     \}
   \textcolor{keywordflow}{else}
     \{
        Feedback\_Thread\_Data *ftd;
        \textcolor{keywordtype}{char} *str;
        \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(\textcolor{stringliteral}{"count"},
                                     (\textcolor{keywordtype}{void} *)(uintptr\_t)\hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(path\_list), NULL,
                                     \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        i = 0;
        \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(path\_list, str)
          \{
             \textcolor{keywordtype}{char} buf[32];
             snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"data%d"}, i);
             ftd = calloc(1, \textcolor{keyword}{sizeof}(Feedback\_Thread\_Data));
             ftd->name = strdup(buf);
             ftd->base = strdup(str);
             \hyperlink{group__Eina__Lock__Group_ga8dda398c1db315582a80640c7f78f648}{eina\_lock\_new}(&ftd->mutex);
             \hyperlink{group__Ecore__Thread__Group_ga4e9de7492f8400e19ddd157d8cc21811}{ecore\_thread\_global\_data\_add}(ftd->name, ftd, NULL, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
             free(str);
             i++;
          \}
     \}

   \hyperlink{group__Eina__Lock__Group_ga8dda398c1db315582a80640c7f78f648}{eina\_lock\_new}(&appdata.mutex);
   \hyperlink{group__Eina__Lock__Group_gaab2b734db1cbdaffe79559f6716ac793}{eina\_condition\_new}(&appdata.condition, &appdata.mutex);

   \hyperlink{group__Ecore__Thread__Group_ga4bde6b50e177f26ab5b2688aa99e3878}{ecore\_thread\_feedback\_run}(\_out\_of\_pool\_job, \_feedback\_job\_msg\_cb, NULL,
                             NULL, &appdata, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

   \hyperlink{group__Ecore__Thread__Group_gaac9c9933ef0a90ba86f8fd0247e9c7ef}{ecore\_thread\_run}(\_short\_job, \_thread\_end\_cb, \_thread\_cancel\_cb, &appdata);
   \hyperlink{group__Ecore__Thread__Group_ga4bde6b50e177f26ab5b2688aa99e3878}{ecore\_thread\_feedback\_run}(\_feedback\_job, \_feedback\_job\_msg\_cb,
                             \_thread\_end\_cb, \_thread\_cancel\_cb, &appdata,
                             \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
   appdata.thread\_3 = \hyperlink{group__Ecore__Thread__Group_gaac9c9933ef0a90ba86f8fd0247e9c7ef}{ecore\_thread\_run}(\_short\_job, \_thread\_end\_cb,
                                       \_thread\_cancel\_cb, &appdata);
   \hyperlink{group__Ecore__Thread__Group_ga4bde6b50e177f26ab5b2688aa99e3878}{ecore\_thread\_feedback\_run}(\_feedback\_job, \_feedback\_job\_msg\_cb,
                             \_thread\_end\_cb, \_thread\_cancel\_cb, &appdata,
                             \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});

   \hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}(1.0, \_cancel\_timer\_cb, &appdata);
   \hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}(2.0, \_status\_timer\_cb, NULL);

   \_print\_status();

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

   \hyperlink{group__Eina__Lock__Group_ga838e1e7dfc8bbf114634a7de67de8956}{eina\_condition\_free}(&appdata.condition);
   \hyperlink{group__Eina__Lock__Group_gaf8d1c4e3aff3bd26fc85d81ed8c4e71a}{eina\_lock\_free}(&appdata.mutex);

   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

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