\hypertarget{group__Eina__Thread__Group}{\section{Thread}
\label{group__Eina__Thread__Group}\index{Thread@{Thread}}
}


Abstracts platform threads, providing an uniform A\-P\-I.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Thread__Group_gaab806ea6ce5d81de0e0b63ef8f03d14e}{typedef unsigned long int {\bfseries Eina\-\_\-\-Thread}}\label{group__Eina__Thread__Group_gaab806ea6ce5d81de0e0b63ef8f03d14e}

\item 
\hypertarget{group__Eina__Thread__Group_ga43767a520c9d32e43c51aa767f5f85a1}{typedef void $\ast$($\ast$ {\bfseries Eina\-\_\-\-Thread\-\_\-\-Cb} )(void $\ast$data, Eina\-\_\-\-Thread t)}\label{group__Eina__Thread__Group_ga43767a520c9d32e43c51aa767f5f85a1}

\item 
\hypertarget{group__Eina__Thread__Group_ga88a2ea778913180e216305f7c7db9303}{typedef enum \-\_\-\-Eina\-\_\-\-Thread\-\_\-\-Priority {\bfseries Eina\-\_\-\-Thread\-\_\-\-Priority}}\label{group__Eina__Thread__Group_ga88a2ea778913180e216305f7c7db9303}

\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum {\bfseries \-\_\-\-Eina\-\_\-\-Thread\-\_\-\-Priority} \{ \\*
{\bfseries E\-I\-N\-A\-\_\-\-T\-H\-R\-E\-A\-D\-\_\-\-U\-R\-G\-E\-N\-T}, 
\\*
{\bfseries E\-I\-N\-A\-\_\-\-T\-H\-R\-E\-A\-D\-\_\-\-N\-O\-R\-M\-A\-L}, 
\\*
{\bfseries E\-I\-N\-A\-\_\-\-T\-H\-R\-E\-A\-D\-\_\-\-B\-A\-C\-K\-G\-R\-O\-U\-N\-D}, 
\\*
{\bfseries E\-I\-N\-A\-\_\-\-T\-H\-R\-E\-A\-D\-\_\-\-I\-D\-L\-E}
 \}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Eina\-\_\-\-Thread \hyperlink{group__Eina__Thread__Group_gacdaf8730f9e593fa025de487609524fa}{eina\-\_\-thread\-\_\-self} (void)
\begin{DoxyCompactList}\small\item\em Return identifier of the current thread. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\-\_\-\-Bool} \hyperlink{group__Eina__Thread__Group_gacbccfd9039ea4e1555af9ded7d6ef571}{eina\-\_\-thread\-\_\-equal} (Eina\-\_\-\-Thread t1, Eina\-\_\-\-Thread t2)
\begin{DoxyCompactList}\small\item\em Check if two thread identifiers are the same. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\-\_\-\-Bool} \hyperlink{group__Eina__Thread__Group_gaac5a08be9aabf19e56de715f6a9e8af5}{eina\-\_\-thread\-\_\-create} (Eina\-\_\-\-Thread $\ast$t, Eina\-\_\-\-Thread\-\_\-\-Priority prio, int affinity, Eina\-\_\-\-Thread\-\_\-\-Cb func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Create a new thread, setting its priority and affinity. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Eina__Thread__Group_ga8f0b8fa727aa899cd88e9d2909f8a588}{eina\-\_\-thread\-\_\-join} (Eina\-\_\-\-Thread t)
\begin{DoxyCompactList}\small\item\em Join a currently running thread, waiting until it finishes. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Abstracts platform threads, providing an uniform A\-P\-I. It's modeled after P\-O\-S\-I\-X T\-H\-R\-E\-A\-D\-S (pthreads), on Linux they are almost 1\-:1 mapping.

\begin{DoxySeeAlso}{See Also}
\hyperlink{group__Eina__Lock__Group}{Lock} for mutex/locking abstraction.
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\-8 
\end{DoxySince}


\subsection{Function Documentation}
\hypertarget{group__Eina__Thread__Group_gacdaf8730f9e593fa025de487609524fa}{\index{Thread@{Thread}!eina\-\_\-thread\-\_\-self@{eina\-\_\-thread\-\_\-self}}
\index{eina\-\_\-thread\-\_\-self@{eina\-\_\-thread\-\_\-self}!Thread@{Thread}}
\subsubsection[{eina\-\_\-thread\-\_\-self}]{\setlength{\rightskip}{0pt plus 5cm}Eina\-\_\-\-Thread eina\-\_\-thread\-\_\-self (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Group_gacdaf8730f9e593fa025de487609524fa}


Return identifier of the current thread. 

\begin{DoxyReturn}{Returns}
identifier of current thread. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-8 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Group_gacbccfd9039ea4e1555af9ded7d6ef571}{\index{Thread@{Thread}!eina\-\_\-thread\-\_\-equal@{eina\-\_\-thread\-\_\-equal}}
\index{eina\-\_\-thread\-\_\-equal@{eina\-\_\-thread\-\_\-equal}!Thread@{Thread}}
\subsubsection[{eina\-\_\-thread\-\_\-equal}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\-\_\-\-Bool} eina\-\_\-thread\-\_\-equal (
\begin{DoxyParamCaption}
\item[{Eina\-\_\-\-Thread}]{t1, }
\item[{Eina\-\_\-\-Thread}]{t2}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Group_gacbccfd9039ea4e1555af9ded7d6ef571}


Check if two thread identifiers are the same. 


\begin{DoxyParams}{Parameters}
{\em t1} & first thread identifier to compare. \\
\hline
{\em t2} & second thread identifier to compare. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\-I\-N\-A\-\_\-\-T\-R\-U\-E} if they are equal, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E} otherwise. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-8 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Group_gaac5a08be9aabf19e56de715f6a9e8af5}{\index{Thread@{Thread}!eina\-\_\-thread\-\_\-create@{eina\-\_\-thread\-\_\-create}}
\index{eina\-\_\-thread\-\_\-create@{eina\-\_\-thread\-\_\-create}!Thread@{Thread}}
\subsubsection[{eina\-\_\-thread\-\_\-create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\-\_\-\-Bool} eina\-\_\-thread\-\_\-create (
\begin{DoxyParamCaption}
\item[{Eina\-\_\-\-Thread $\ast$}]{t, }
\item[{Eina\-\_\-\-Thread\-\_\-\-Priority}]{prio, }
\item[{int}]{affinity, }
\item[{Eina\-\_\-\-Thread\-\_\-\-Cb}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Group_gaac5a08be9aabf19e56de715f6a9e8af5}


Create a new thread, setting its priority and affinity. 


\begin{DoxyParams}{Parameters}
{\em t\mbox{[}out\mbox{]}} & where to return the thread identifier. Must {\bfseries not} be {\ttfamily N\-U\-L\-L}. \\
\hline
{\em prio} & thread priority to use, usually \#\-E\-I\-N\-A\-\_\-\-T\-H\-R\-E\-A\-D\-\_\-\-B\-A\-C\-K\-G\-R\-O\-U\-N\-D \\
\hline
{\em affinity} & thread affinity to use. To not set affinity use {\ttfamily -\/1}. \\
\hline
{\em func} & function to run in the thread. Must {\bfseries not} be {\ttfamily N\-U\-L\-L}. \\
\hline
{\em data} & context data to provide to {\itshape func} as first argument. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\-I\-N\-A\-\_\-\-T\-R\-U\-E} if thread was created, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E} on errors. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-8 
\end{DoxySince}


References E\-I\-N\-A\-\_\-\-F\-A\-L\-S\-E, and E\-I\-N\-A\-\_\-\-T\-R\-U\-E.

\hypertarget{group__Eina__Thread__Group_ga8f0b8fa727aa899cd88e9d2909f8a588}{\index{Thread@{Thread}!eina\-\_\-thread\-\_\-join@{eina\-\_\-thread\-\_\-join}}
\index{eina\-\_\-thread\-\_\-join@{eina\-\_\-thread\-\_\-join}!Thread@{Thread}}
\subsubsection[{eina\-\_\-thread\-\_\-join}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ eina\-\_\-thread\-\_\-join (
\begin{DoxyParamCaption}
\item[{Eina\-\_\-\-Thread}]{t}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Group_ga8f0b8fa727aa899cd88e9d2909f8a588}


Join a currently running thread, waiting until it finishes. 

This function will block the current thread until {\itshape t} finishes. The returned value is the one returned by {\itshape t} {\ttfamily func()} and may be {\ttfamily N\-U\-L\-L} on errors. See \hyperlink{group__Eina__Error__Group}{Error} to identify problems.


\begin{DoxyParams}{Parameters}
{\em t} & thread identifier to wait. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
value returned by {\itshape t} creation function {\ttfamily func()} or {\ttfamily N\-U\-L\-L} on errors. Check error with \hyperlink{group__Eina__Error__Group}{Error}. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-8 
\end{DoxySince}
