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


Abstracts platform threads, providing an uniform A\+PI.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{}\label{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a} 
typedef uintptr\+\_\+t \hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}
\begin{DoxyCompactList}\small\item\em Type for a generic thread. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{}\label{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26} 
typedef void $\ast$($\ast$ \hyperlink{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{Eina\+\_\+\+Thread\+\_\+\+Cb}) (void $\ast$data, \hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} t)
\begin{DoxyCompactList}\small\item\em Type for the definition of a thread callback function. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Thread__Group_ga88a2ea778913180e216305f7c7db9303}{}\label{group__Eina__Thread__Group_ga88a2ea778913180e216305f7c7db9303} 
typedef enum \+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Priority {\bfseries Eina\+\_\+\+Thread\+\_\+\+Priority}
\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}{}\label{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c} 
enum {\bfseries \+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Priority} \{ \newline
{\bfseries E\+I\+N\+A\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+U\+R\+G\+E\+NT}, 
\newline
{\bfseries E\+I\+N\+A\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+N\+O\+R\+M\+AL}, 
\newline
{\bfseries E\+I\+N\+A\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+B\+A\+C\+K\+G\+R\+O\+U\+ND}, 
\newline
{\bfseries E\+I\+N\+A\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+I\+D\+LE}
 \}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{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} (\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} t1, \hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{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} (\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} $\ast$t, Eina\+\_\+\+Thread\+\_\+\+Priority prio, int affinity, \hyperlink{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{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} (\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} t)
\begin{DoxyCompactList}\small\item\em Join a currently running thread, waiting until it finishes. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Thread__Group_gafe38e131374f93f1e2b1b1dcd08557f2}{eina\+\_\+thread\+\_\+name\+\_\+set} (\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} t, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Set the name of a given thread for debugging purposes. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Abstracts platform threads, providing an uniform A\+PI. 

It\textquotesingle{}s modeled after P\+O\+S\+IX T\+H\+R\+E\+A\+DS (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}{}\label{group__Eina__Thread__Group_gacdaf8730f9e593fa025de487609524fa} 
\index{Thread@{Thread}!eina\+\_\+thread\+\_\+self@{eina\+\_\+thread\+\_\+self}}
\index{eina\+\_\+thread\+\_\+self@{eina\+\_\+thread\+\_\+self}!Thread@{Thread}}
\subsubsection{\texorpdfstring{eina\+\_\+thread\+\_\+self()}{eina\_thread\_self()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} eina\+\_\+thread\+\_\+self (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Return identifier of the current thread. 

\begin{DoxyReturn}{Returns}
identifier of current thread. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}


Referenced by efl\+::eina\+::swap().

\hypertarget{group__Eina__Thread__Group_gacbccfd9039ea4e1555af9ded7d6ef571}{}\label{group__Eina__Thread__Group_gacbccfd9039ea4e1555af9ded7d6ef571} 
\index{Thread@{Thread}!eina\+\_\+thread\+\_\+equal@{eina\+\_\+thread\+\_\+equal}}
\index{eina\+\_\+thread\+\_\+equal@{eina\+\_\+thread\+\_\+equal}!Thread@{Thread}}
\subsubsection{\texorpdfstring{eina\+\_\+thread\+\_\+equal()}{eina\_thread\_equal()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+thread\+\_\+equal (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}]{t1,  }\item[{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}]{t2 }\end{DoxyParamCaption})}



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\+UE} if they are equal, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE} otherwise. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Group_gaac5a08be9aabf19e56de715f6a9e8af5}{}\label{group__Eina__Thread__Group_gaac5a08be9aabf19e56de715f6a9e8af5} 
\index{Thread@{Thread}!eina\+\_\+thread\+\_\+create@{eina\+\_\+thread\+\_\+create}}
\index{eina\+\_\+thread\+\_\+create@{eina\+\_\+thread\+\_\+create}!Thread@{Thread}}
\subsubsection{\texorpdfstring{eina\+\_\+thread\+\_\+create()}{eina\_thread\_create()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+thread\+\_\+create (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread} $\ast$}]{t,  }\item[{Eina\+\_\+\+Thread\+\_\+\+Priority}]{prio,  }\item[{int}]{affinity,  }\item[{\hyperlink{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{Eina\+\_\+\+Thread\+\_\+\+Cb}}]{func,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}



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\+LL}. \\
\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\+ND \\
\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\+LL}. \\
\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\+UE} if thread was created, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE} on errors. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}


Referenced by efl\+::eina\+::thread\+::thread().

\hypertarget{group__Eina__Thread__Group_ga8f0b8fa727aa899cd88e9d2909f8a588}{}\label{group__Eina__Thread__Group_ga8f0b8fa727aa899cd88e9d2909f8a588} 
\index{Thread@{Thread}!eina\+\_\+thread\+\_\+join@{eina\+\_\+thread\+\_\+join}}
\index{eina\+\_\+thread\+\_\+join@{eina\+\_\+thread\+\_\+join}!Thread@{Thread}}
\subsubsection{\texorpdfstring{eina\+\_\+thread\+\_\+join()}{eina\_thread\_join()}}
{\footnotesize\ttfamily void$\ast$ eina\+\_\+thread\+\_\+join (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}]{t }\end{DoxyParamCaption})}



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\+LL} 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\+LL} on errors. Check error with \hyperlink{group__Eina__Error__Group}{Error}. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}


Referenced by efl\+::eina\+::thread\+::join().

\hypertarget{group__Eina__Thread__Group_gafe38e131374f93f1e2b1b1dcd08557f2}{}\label{group__Eina__Thread__Group_gafe38e131374f93f1e2b1b1dcd08557f2} 
\index{Thread@{Thread}!eina\+\_\+thread\+\_\+name\+\_\+set@{eina\+\_\+thread\+\_\+name\+\_\+set}}
\index{eina\+\_\+thread\+\_\+name\+\_\+set@{eina\+\_\+thread\+\_\+name\+\_\+set}!Thread@{Thread}}
\subsubsection{\texorpdfstring{eina\+\_\+thread\+\_\+name\+\_\+set()}{eina\_thread\_name\_set()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+thread\+\_\+name\+\_\+set (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}]{t,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Set the name of a given thread for debugging purposes. 

This maps to the pthread\+\_\+setname\+\_\+np() G\+NU extension or similar if available. The name may be limited in size (possibly 16 characters including the nul byte terminator). This is useful for debugging to name a thread so external tools can display a meaningful name attached to the thread.


\begin{DoxyParams}{Parameters}
{\em t} & thread to set the name of \\
\hline
{\em name} & a string to name the thread -\/ this cannot be N\+U\+LL \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+UE if it succeeds in setting the name or E\+I\+N\+A\+\_\+\+F\+A\+L\+SE otherwise. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+16 
\end{DoxySince}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+SE, and E\+I\+N\+A\+\_\+\+T\+R\+UE.

