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


Abstracts platform threads, providing a uniform API.  


\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH}}(cleanup,  data)~  pthread\+\_\+cleanup\+\_\+push(cleanup, data)
\begin{DoxyCompactList}\small\item\em Pushes a cleanup function to be executed when the thread is canceled. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP}}(exec\+\_\+cleanup)~  pthread\+\_\+cleanup\+\_\+pop(exec\+\_\+cleanup)
\begin{DoxyCompactList}\small\item\em Pops a cleanup function to be executed when the thread is canceled. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}\label{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}} 
typedef uintptr\+\_\+t {\bfseries Eina\+\_\+\+Thread}
\begin{DoxyCompactList}\small\item\em Type for a generic thread. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}\label{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}} 
typedef void $\ast$($\ast$ {\bfseries Eina\+\_\+\+Thread\+\_\+\+Cb}) (void $\ast$data, \mbox{\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 
\mbox{\Hypertarget{group__Eina__Thread__Group_ga0117b890d66e44e040f5bbfdc0de2aec}\label{group__Eina__Thread__Group_ga0117b890d66e44e040f5bbfdc0de2aec}} 
typedef void($\ast$ {\bfseries Eina\+\_\+\+Thread\+\_\+\+Cleanup\+\_\+\+Cb}) (void $\ast$data)
\begin{DoxyCompactList}\small\item\em Type for the definition of a thread cleanup function. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Thread__Group_ga240e6f04f3d6a051f2b16d0c2403cfc8}\label{group__Eina__Thread__Group_ga240e6f04f3d6a051f2b16d0c2403cfc8}} 
typedef enum \mbox{\hyperlink{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Priority}} {\bfseries Eina\+\_\+\+Thread\+\_\+\+Priority}
\begin{DoxyCompactList}\small\item\em Type to enumerate different thread priorities. \end{DoxyCompactList}\item 
typedef void $\ast$($\ast$ \mbox{\hyperlink{group__Eina__Thread__Group_ga117083fbebdb7789f41e57315f6b8a59}{Eina\+\_\+\+Thread\+\_\+\+Cancellable\+\_\+\+Run\+\_\+\+Cb}}) (void $\ast$data)
\begin{DoxyCompactList}\small\item\em Type for the definition of a cancellable callback to run. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Priority}} \{ \newline
\mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca842869f263198ebe0449ed608cea24ad}{EINA\+\_\+\+THREAD\+\_\+\+URGENT}}
, \newline
\mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca054acf2389c4fc3386f0f50c0f616284}{EINA\+\_\+\+THREAD\+\_\+\+NORMAL}}
, \newline
\mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca2514f34b3df808b93bccca33fb477ebe}{EINA\+\_\+\+THREAD\+\_\+\+BACKGROUND}}
, \newline
\mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca69ca04b3cde0f80f9f9540576c388600}{EINA\+\_\+\+THREAD\+\_\+\+IDLE}}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} \mbox{\hyperlink{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}{eina\+\_\+thread\+\_\+self}} (void)
\begin{DoxyCompactList}\small\item\em Returns identifier of the current thread. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Thread__Group_gaa0eee2ad81ea18d09d30f7812b78b101}{eina\+\_\+thread\+\_\+equal}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} t1, \mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} t2)
\begin{DoxyCompactList}\small\item\em Checks if two thread identifiers are the same. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Thread__Group_gad648cc0b3bbdf78f3fd7d82bdc3af6e7}{eina\+\_\+thread\+\_\+create}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} $\ast$t, \mbox{\hyperlink{group__Eina__Thread__Group_ga240e6f04f3d6a051f2b16d0c2403cfc8}{Eina\+\_\+\+Thread\+\_\+\+Priority}} prio, int affinity, \mbox{\hyperlink{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{Eina\+\_\+\+Thread\+\_\+\+Cb}} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Creates a new thread, setting its priority and affinity. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void $\ast$ \mbox{\hyperlink{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}{eina\+\_\+thread\+\_\+join}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} t)
\begin{DoxyCompactList}\small\item\em Joins a currently running thread, waiting until it finishes. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Thread__Group_ga099238239a062cf6b33453d599ad0106}{eina\+\_\+thread\+\_\+name\+\_\+set}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} t, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Sets the name of a given thread for debugging purposes. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} t)
\begin{DoxyCompactList}\small\item\em Attempts to cancel a running thread. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set}} (\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} cancellable, \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} $\ast$was\+\_\+cancellable)
\begin{DoxyCompactList}\small\item\em Enables or disables if the current thread can be canceled. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint}} (void)
\begin{DoxyCompactList}\small\item\em If the current thread is cancellable, this introduces a cancellation check point. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void $\ast$ \mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run}} (\mbox{\hyperlink{group__Eina__Thread__Group_ga117083fbebdb7789f41e57315f6b8a59}{Eina\+\_\+\+Thread\+\_\+\+Cancellable\+\_\+\+Run\+\_\+\+Cb}} cb, \mbox{\hyperlink{group__Eina__Types__Group_gadbac560ba2bca5c61d97bfbb542018f3}{Eina\+\_\+\+Free\+\_\+\+Cb}} cleanup\+\_\+cb, void $\ast$data)
\begin{DoxyCompactList}\small\item\em This function will setup cleanup callback, turn the thread cancellable, execute the given callback, reset the cancellable state to its old value, run the cleanup callback and then return the callback return value. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Thread__Group_gae78e0a9df873eb074545bee2775f6341}{eina\+\_\+sched\+\_\+prio\+\_\+drop}} (void)
\begin{DoxyCompactList}\small\item\em Lowers the priority of the current thread. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} const void $\ast$ \mbox{\hyperlink{group__Eina__Thread__Group_ga82955015683548d0c46d82d8848d4a7c}{EINA\+\_\+\+THREAD\+\_\+\+JOIN\+\_\+\+CANCELED}}
\begin{DoxyCompactList}\small\item\em The return value of \mbox{\hyperlink{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}{eina\+\_\+thread\+\_\+join()}} if it was canceled with \mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel()}}. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Abstracts platform threads, providing a uniform API. 

It\textquotesingle{}s modeled after POSIX THREADS (pthreads), on Linux they are almost 1\+:1 mapping.

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


\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}\label{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}} 
\index{Thread@{Thread}!EINA\_THREAD\_CLEANUP\_PUSH@{EINA\_THREAD\_CLEANUP\_PUSH}}
\index{EINA\_THREAD\_CLEANUP\_PUSH@{EINA\_THREAD\_CLEANUP\_PUSH}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{EINA\_THREAD\_CLEANUP\_PUSH}{EINA\_THREAD\_CLEANUP\_PUSH}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH(\begin{DoxyParamCaption}\item[{}]{cleanup,  }\item[{}]{data }\end{DoxyParamCaption})~  pthread\+\_\+cleanup\+\_\+push(cleanup, data)}



Pushes a cleanup function to be executed when the thread is canceled. 

This macro will schedule a function cleanup(data) to be executed if the thread is canceled with \mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel()}} and the thread was previously marked as cancellable with \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}}.

It {\bfseries{must}} be paired with \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP()}} in the same code block as they will expand to do \{\} while ()!

The cleanup function may also be executed if \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP(\+EINA\+\_\+\+TRUE)}} is used.

\begin{DoxyNote}{Note}
If the block within \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} and \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP()}} returns, the cleanup callback will {\bfseries{not}} be executed! To avoid problems prefer to use \mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}}!
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cleanup} & The function to execute on cancellation. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & The context to give to cleanup function.\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}\label{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}} 
\index{Thread@{Thread}!EINA\_THREAD\_CLEANUP\_POP@{EINA\_THREAD\_CLEANUP\_POP}}
\index{EINA\_THREAD\_CLEANUP\_POP@{EINA\_THREAD\_CLEANUP\_POP}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{EINA\_THREAD\_CLEANUP\_POP}{EINA\_THREAD\_CLEANUP\_POP}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP(\begin{DoxyParamCaption}\item[{}]{exec\+\_\+cleanup }\end{DoxyParamCaption})~  pthread\+\_\+cleanup\+\_\+pop(exec\+\_\+cleanup)}



Pops a cleanup function to be executed when the thread is canceled. 

This macro will remove a previously pushed cleanup function, thus if the thread is canceled with \mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel()}} and the thread was previously marked as cancellable with \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}}, that cleanup won\textquotesingle{}t be executed anymore.

It {\bfseries{must}} be paired with \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} in the same code block as they will expand to do \{\} while ()!

\begin{DoxyNote}{Note}
If the block within \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} and \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP()}} returns, the cleanup callback will {\bfseries{not}} be executed even if exec\+\_\+cleanup is EINA\+\_\+\+TRUE! To avoid problems prefer to use \mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}}!
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em exec\+\_\+cleanup} & if EINA\+\_\+\+TRUE, the function registered with \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} will be executed.\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


\doxysubsection{Typedef Documentation}
\mbox{\Hypertarget{group__Eina__Thread__Group_ga117083fbebdb7789f41e57315f6b8a59}\label{group__Eina__Thread__Group_ga117083fbebdb7789f41e57315f6b8a59}} 
\index{Thread@{Thread}!Eina\_Thread\_Cancellable\_Run\_Cb@{Eina\_Thread\_Cancellable\_Run\_Cb}}
\index{Eina\_Thread\_Cancellable\_Run\_Cb@{Eina\_Thread\_Cancellable\_Run\_Cb}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{Eina\_Thread\_Cancellable\_Run\_Cb}{Eina\_Thread\_Cancellable\_Run\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Thread\+\_\+\+Cancellable\+\_\+\+Run\+\_\+\+Cb}



Type for the definition of a cancellable callback to run. 

\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


\doxysubsection{Enumeration Type Documentation}
\mbox{\Hypertarget{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}\label{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}} 
\index{Thread@{Thread}!\_Eina\_Thread\_Priority@{\_Eina\_Thread\_Priority}}
\index{\_Eina\_Thread\_Priority@{\_Eina\_Thread\_Priority}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{\_Eina\_Thread\_Priority}{\_Eina\_Thread\_Priority}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{group__Eina__Thread__Group_gaa4cf7c15a40c7d4eeaf1e96f0d559c2c}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Priority}}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_THREAD\_URGENT@{EINA\_THREAD\_URGENT}!Thread@{Thread}}\index{Thread@{Thread}!EINA\_THREAD\_URGENT@{EINA\_THREAD\_URGENT}}}\mbox{\Hypertarget{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca842869f263198ebe0449ed608cea24ad}\label{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca842869f263198ebe0449ed608cea24ad}} 
EINA\+\_\+\+THREAD\+\_\+\+URGENT&Higher than average process priority. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_THREAD\_NORMAL@{EINA\_THREAD\_NORMAL}!Thread@{Thread}}\index{Thread@{Thread}!EINA\_THREAD\_NORMAL@{EINA\_THREAD\_NORMAL}}}\mbox{\Hypertarget{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca054acf2389c4fc3386f0f50c0f616284}\label{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca054acf2389c4fc3386f0f50c0f616284}} 
EINA\+\_\+\+THREAD\+\_\+\+NORMAL&Standard process priority. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_THREAD\_BACKGROUND@{EINA\_THREAD\_BACKGROUND}!Thread@{Thread}}\index{Thread@{Thread}!EINA\_THREAD\_BACKGROUND@{EINA\_THREAD\_BACKGROUND}}}\mbox{\Hypertarget{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca2514f34b3df808b93bccca33fb477ebe}\label{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca2514f34b3df808b93bccca33fb477ebe}} 
EINA\+\_\+\+THREAD\+\_\+\+BACKGROUND&Lower than average process priority. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{EINA\_THREAD\_IDLE@{EINA\_THREAD\_IDLE}!Thread@{Thread}}\index{Thread@{Thread}!EINA\_THREAD\_IDLE@{EINA\_THREAD\_IDLE}}}\mbox{\Hypertarget{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca69ca04b3cde0f80f9f9540576c388600}\label{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca69ca04b3cde0f80f9f9540576c388600}} 
EINA\+\_\+\+THREAD\+\_\+\+IDLE&Thread to be executed only when the processor is idle. \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}\label{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}} 
\index{Thread@{Thread}!eina\_thread\_self@{eina\_thread\_self}}
\index{eina\_thread\_self@{eina\_thread\_self}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_self()}{eina\_thread\_self()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} eina\+\_\+thread\+\_\+self (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Returns identifier of the current thread. 

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


References \mbox{\hyperlink{group__Eina__Array__Group_gaf4b5844225b5359a617744210a5ed6ff}{eina\+\_\+array\+\_\+new()}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Ecore__Thread__Group_ga786b2db76a8bc29bca9f6f9cd41bc588}{ecore\+\_\+thread\+\_\+name\+\_\+set()}}, \mbox{\hyperlink{group__Eina__Thread__Group_gae78e0a9df873eb074545bee2775f6341}{eina\+\_\+sched\+\_\+prio\+\_\+drop()}}, \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}}, and \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_gaa0eee2ad81ea18d09d30f7812b78b101}\label{group__Eina__Thread__Group_gaa0eee2ad81ea18d09d30f7812b78b101}} 
\index{Thread@{Thread}!eina\_thread\_equal@{eina\_thread\_equal}}
\index{eina\_thread\_equal@{eina\_thread\_equal}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_equal()}{eina\_thread\_equal()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+thread\+\_\+equal (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}}]{t1,  }\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}}]{t2 }\end{DoxyParamCaption})}



Checks if two thread identifiers are the same. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t1} & first thread identifier to compare. \\
\hline
\mbox{\texttt{ in}}  & {\em t2} & second thread identifier to compare. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} if they are equal, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} otherwise. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}
\mbox{\Hypertarget{group__Eina__Thread__Group_gad648cc0b3bbdf78f3fd7d82bdc3af6e7}\label{group__Eina__Thread__Group_gad648cc0b3bbdf78f3fd7d82bdc3af6e7}} 
\index{Thread@{Thread}!eina\_thread\_create@{eina\_thread\_create}}
\index{eina\_thread\_create@{eina\_thread\_create}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_create()}{eina\_thread\_create()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+thread\+\_\+create (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}} $\ast$}]{t,  }\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga240e6f04f3d6a051f2b16d0c2403cfc8}{Eina\+\_\+\+Thread\+\_\+\+Priority}}}]{prio,  }\item[{int}]{affinity,  }\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga4621fcf4fac930dc7f781240bc9dfb26}{Eina\+\_\+\+Thread\+\_\+\+Cb}}}]{func,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}



Creates a new thread, setting its priority and affinity. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em t} & where to return the thread identifier. Must {\bfseries{not}} be {\ttfamily NULL}. \\
\hline
\mbox{\texttt{ in}}  & {\em prio} & thread priority to use, usually EINA\+\_\+\+THREAD\+\_\+\+BACKGROUND \\
\hline
\mbox{\texttt{ in}}  & {\em affinity} & thread affinity to use. To not set affinity use {\ttfamily -\/1}. \\
\hline
\mbox{\texttt{ in}}  & {\em func} & function to run in the thread. Must {\bfseries{not}} be {\ttfamily NULL}. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & context data to provide to {\itshape func} as first argument. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} if thread was created, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} on errors. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Array__Group_ga7fa7e2cdcfb739140d5c5a5044086ce1}{eina\+\_\+array\+\_\+free()}}, \mbox{\hyperlink{group__Eina__Array__Group_gaf4b5844225b5359a617744210a5ed6ff}{eina\+\_\+array\+\_\+new()}}, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}, \mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca2514f34b3df808b93bccca33fb477ebe}{EINA\+\_\+\+THREAD\+\_\+\+BACKGROUND}}, \mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca69ca04b3cde0f80f9f9540576c388600}{EINA\+\_\+\+THREAD\+\_\+\+IDLE}}, \mbox{\hyperlink{group__Eina__Thread__Group_ggaa4cf7c15a40c7d4eeaf1e96f0d559c2ca842869f263198ebe0449ed608cea24ad}{EINA\+\_\+\+THREAD\+\_\+\+URGENT}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}\label{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}} 
\index{Thread@{Thread}!eina\_thread\_join@{eina\_thread\_join}}
\index{eina\_thread\_join@{eina\_thread\_join}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_join()}{eina\_thread\_join()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void $\ast$ eina\+\_\+thread\+\_\+join (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}}]{t }\end{DoxyParamCaption})}



Joins 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 NULL} on errors. See \mbox{\hyperlink{group__Eina__Error__Group}{Error}} to identify problems.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & thread identifier to wait. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
value returned by {\itshape t} creation function {\ttfamily func()} or {\ttfamily NULL} on errors. Check error with \mbox{\hyperlink{group__Eina__Error__Group}{Error}}. If the thread was canceled, it will return EINA\+\_\+\+THREAD\+\_\+\+JOIN\+\_\+\+CANCELED. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+8 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Array__Group_ga7fa7e2cdcfb739140d5c5a5044086ce1}{eina\+\_\+array\+\_\+free()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga099238239a062cf6b33453d599ad0106}\label{group__Eina__Thread__Group_ga099238239a062cf6b33453d599ad0106}} 
\index{Thread@{Thread}!eina\_thread\_name\_set@{eina\_thread\_name\_set}}
\index{eina\_thread\_name\_set@{eina\_thread\_name\_set}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_name\_set()}{eina\_thread\_name\_set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+thread\+\_\+name\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}}]{t,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Sets the name of a given thread for debugging purposes. 

This maps to the pthread\+\_\+setname\+\_\+np() GNU extension or similar if available. The name may be limited in size (possibly 16 characters including the null 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}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & thread to set the name of \\
\hline
\mbox{\texttt{ in}}  & {\em name} & a string to name the thread -\/ this cannot be NULL \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
EINA\+\_\+\+TRUE if it succeeds in setting the name or EINA\+\_\+\+FALSE otherwise. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+16 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Ecore__Thread__Group_ga786b2db76a8bc29bca9f6f9cd41bc588}{ecore\+\_\+thread\+\_\+name\+\_\+set()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}\label{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}} 
\index{Thread@{Thread}!eina\_thread\_cancel@{eina\_thread\_cancel}}
\index{eina\_thread\_cancel@{eina\_thread\_cancel}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_cancel()}{eina\_thread\_cancel()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+thread\+\_\+cancel (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga1e85dc4b7b825ef36a5ae9d8b710523a}{Eina\+\_\+\+Thread}}}]{t }\end{DoxyParamCaption})}



Attempts to cancel a running thread. 

This function sends a cancellation request to the thread, however that request is only fulfilled if the thread is cancellable (\mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}} with EINA\+\_\+\+TRUE as first parameter) and it will wait for a cancellation point, be \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}} or some syscall as defined in man\+:pthreads(7).

A thread that was canceled will return EINA\+\_\+\+THREAD\+\_\+\+JOIN\+\_\+\+CANCELED when \mbox{\hyperlink{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}{eina\+\_\+thread\+\_\+join()}} is called.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Thread to cancel.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
EINA\+\_\+\+FALSE if thread was not running, EINA\+\_\+\+TRUE otherwise. Note that if a thread is not cancellable and it is running, this function will return EINA\+\_\+\+TRUE!
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Ecore__Thread__Group_gae9b9b20e1ed53c62c51617b55aed2511}{ecore\+\_\+thread\+\_\+cancel()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}\label{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}} 
\index{Thread@{Thread}!eina\_thread\_cancellable\_set@{eina\_thread\_cancellable\_set}}
\index{eina\_thread\_cancellable\_set@{eina\_thread\_cancellable\_set}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_cancellable\_set()}{eina\_thread\_cancellable\_set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+thread\+\_\+cancellable\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}}}]{cancellable,  }\item[{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} $\ast$}]{was\+\_\+cancellable }\end{DoxyParamCaption})}



Enables or disables if the current thread can be canceled. 

By default \mbox{\hyperlink{group__Eina__Thread__Group_gad648cc0b3bbdf78f3fd7d82bdc3af6e7}{eina\+\_\+thread\+\_\+create()}} will return a thread with cancellation disabled. One can enable the cancellation by using EINA\+\_\+\+TRUE in {\itshape cancellable}.

Eina threads follow pthread\+\_\+setcanceltype() PTHREAD\+\_\+\+CANCEL\+\_\+\+DEFERRED, that is, the actual termination will wait for a cancellation point, usually a syscall defined in man\+:pthreads(7) or an explicit cancellation point defined with \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}}.

In order to provide cleanup around critical blocks use \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} and \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP()}} macros (which maps to pthread\+\_\+cleanup\+\_\+push() and pthread\+\_\+cleanup\+\_\+pop()), or the helper function \mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}} which does the pair for you.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cancellable} & If EINA\+\_\+\+TRUE, this thread will be accept cancellation requests. If EINA\+\_\+\+FALSE -- the default, it will ignore cancellation requests. \\
\hline
\mbox{\texttt{ in}}  & {\em was\+\_\+cancellable} & If non-\/\+NULL, will return the previous state, shall you want to restore.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
EINA\+\_\+\+TRUE if it succeeds in setting the cancellable state or EINA\+\_\+\+FALSE otherwise.
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}} 

\mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH()}} 

\mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP()}} 

\mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}} 

\mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}{eina\+\_\+thread\+\_\+self()}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}{eina\+\_\+thread\+\_\+cancellable\+\_\+run()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}\label{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}} 
\index{Thread@{Thread}!eina\_thread\_cancel\_checkpoint@{eina\_thread\_cancel\_checkpoint}}
\index{eina\_thread\_cancel\_checkpoint@{eina\_thread\_cancel\_checkpoint}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_cancel\_checkpoint()}{eina\_thread\_cancel\_checkpoint()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



If the current thread is cancellable, this introduces a cancellation check point. 

Otherwise it\textquotesingle{}s a no-\/operation.

Eina threads follow pthread\+\_\+setcanceltype() PTHREAD\+\_\+\+CANCEL\+\_\+\+DEFERRED, that is, the actual termination will wait for a cancellation point, usually a syscall defined in man\+:pthreads(7) or an explicit cancellation point defined with this function.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Array__Group_gafcc60b430bbc132114ef041e589d3ecf}{eina\+\_\+array\+\_\+count()}}, \mbox{\hyperlink{group__Eina__Array__Group_ga329683a8ccfa53ecfc70f04d7f471560}{eina\+\_\+array\+\_\+pop()}}, \mbox{\hyperlink{group__Eina__Thread__Group_ga82955015683548d0c46d82d8848d4a7c}{EINA\+\_\+\+THREAD\+\_\+\+JOIN\+\_\+\+CANCELED}}, and \mbox{\hyperlink{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}{eina\+\_\+thread\+\_\+self()}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}\label{group__Eina__Thread__Group_ga3a6ec5c1b2cad7c3a6f0dd38c2dcb71b}} 
\index{Thread@{Thread}!eina\_thread\_cancellable\_run@{eina\_thread\_cancellable\_run}}
\index{eina\_thread\_cancellable\_run@{eina\_thread\_cancellable\_run}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_thread\_cancellable\_run()}{eina\_thread\_cancellable\_run()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void $\ast$ eina\+\_\+thread\+\_\+cancellable\+\_\+run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Thread__Group_ga117083fbebdb7789f41e57315f6b8a59}{Eina\+\_\+\+Thread\+\_\+\+Cancellable\+\_\+\+Run\+\_\+\+Cb}}}]{cb,  }\item[{\mbox{\hyperlink{group__Eina__Types__Group_gadbac560ba2bca5c61d97bfbb542018f3}{Eina\+\_\+\+Free\+\_\+\+Cb}}}]{cleanup\+\_\+cb,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



This function will setup cleanup callback, turn the thread cancellable, execute the given callback, reset the cancellable state to its old value, run the cleanup callback and then return the callback return value. 

\begin{DoxyNote}{Note}
cleanup\+\_\+cb is configured {\bfseries{before}} the thread is made cancellable, thus it {\bfseries{will}} be executed while {\itshape cb} may not in the case the thread was already canceled and that was pending.
\end{DoxyNote}
This helper does exactly the following code. Should you need a slightly different behavior, use the base calls yourself.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ old\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ *ret;}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\_THREAD\_CLEANUP\_PUSH}}(cleanup\_cb,\ data);}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\_thread\_cancellable\_set}}(\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}},\ \&old);\ \textcolor{comment}{//\ is\ a\ cancellation\ point}}
\DoxyCodeLine{ret\ =\ cb(data);\ \textcolor{comment}{//\ may\ not\ run\ if\ was\ previously\ canceled}}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\_THREAD\_CLEANUP\_POP}}(\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\_thread\_cancellable\_set}}(old,\ NULL);}
\DoxyCodeLine{\textcolor{keywordflow}{return}\ ret;}

\end{DoxyCode}



\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cb} & a cancellable callback to possibly run. The callback {\bfseries{may}} not be executed if the thread had a pending cancellation request. During its execution the callback may be canceled at explicit cancellation points using \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}}, as well as some syscalls defined in man\+:pthreads(7). \\
\hline
\mbox{\texttt{ in}}  & {\em cleanup\+\_\+cb} & a cleanup callback to be executed regardless of the thread being canceled or not. This function will be executed even if {\itshape cb} wasn\textquotesingle{}t. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & context to give to both {\itshape cb} and {\itshape cleanup\+\_\+cb}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the return value of {\itshape cb}. If the thread was canceled, this function will not return.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}}, \mbox{\hyperlink{group__Eina__Thread__Group_gad33b7c1ec50b300be47e53832ff70b90}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+POP}}, \mbox{\hyperlink{group__Eina__Thread__Group_gacbfb74a9554f86829a021b6074ef9b31}{EINA\+\_\+\+THREAD\+\_\+\+CLEANUP\+\_\+\+PUSH}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.

\mbox{\Hypertarget{group__Eina__Thread__Group_gae78e0a9df873eb074545bee2775f6341}\label{group__Eina__Thread__Group_gae78e0a9df873eb074545bee2775f6341}} 
\index{Thread@{Thread}!eina\_sched\_prio\_drop@{eina\_sched\_prio\_drop}}
\index{eina\_sched\_prio\_drop@{eina\_sched\_prio\_drop}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{eina\_sched\_prio\_drop()}{eina\_sched\_prio\_drop()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+sched\+\_\+prio\+\_\+drop (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Lowers the priority of the current thread. 

It\textquotesingle{}s used by worker threads so that they use up the background CPU and do not stall the main thread. If the current thread is running with real-\/time priority, we decrease our priority by {\ttfamily RTNICENESS}. This is done in a portable way.

Otherwise, (we are running with the SCHED\+\_\+\+OTHER policy) there\textquotesingle{}s no portable way to set the nice level on the current thread. In Linux, it does work and it\textquotesingle{}s the only one that is implemented as of now. In this case, the nice level is incremented on this thread by {\ttfamily NICENESS}. 

References \mbox{\hyperlink{group__Eina__Log__Group_ga2e33caeeeb6051526c01b7fea4d6c91b}{EINA\+\_\+\+LOG\+\_\+\+ERR}}, \mbox{\hyperlink{group__Eina__Log__Group_gafb145e82df0f9441244832c94e87a21b}{EINA\+\_\+\+LOG\+\_\+\+INFO}}, \mbox{\hyperlink{group__Eina__Thread__Group_gacd61c43d4ffe9a5b2cb2033b5f77bb4f}{eina\+\_\+thread\+\_\+self()}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga70675a75a5fb3e9a51d5af985a1fd3aa}{EINA\+\_\+\+UNLIKELY}}.



\doxysubsection{Variable Documentation}
\mbox{\Hypertarget{group__Eina__Thread__Group_ga82955015683548d0c46d82d8848d4a7c}\label{group__Eina__Thread__Group_ga82955015683548d0c46d82d8848d4a7c}} 
\index{Thread@{Thread}!EINA\_THREAD\_JOIN\_CANCELED@{EINA\_THREAD\_JOIN\_CANCELED}}
\index{EINA\_THREAD\_JOIN\_CANCELED@{EINA\_THREAD\_JOIN\_CANCELED}!Thread@{Thread}}
\doxysubsubsection{\texorpdfstring{EINA\_THREAD\_JOIN\_CANCELED}{EINA\_THREAD\_JOIN\_CANCELED}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} const void$\ast$ EINA\+\_\+\+THREAD\+\_\+\+JOIN\+\_\+\+CANCELED\hspace{0.3cm}{\ttfamily [extern]}}



The return value of \mbox{\hyperlink{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}{eina\+\_\+thread\+\_\+join()}} if it was canceled with \mbox{\hyperlink{group__Eina__Thread__Group_ga80dc486bb33402ffc20741d3086a8277}{eina\+\_\+thread\+\_\+cancel()}}. 

A thread must be explicitly flagged as cancellable with \mbox{\hyperlink{group__Eina__Thread__Group_ga58f736ee21de29c3c51e9fd37d829b6f}{eina\+\_\+thread\+\_\+cancellable\+\_\+set()}}, by default it\textquotesingle{}s not and this value shouldn\textquotesingle{}t be returned.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Thread__Group_ga8c5531d6b91f77fbc46e35a828fcac80}{eina\+\_\+thread\+\_\+join()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+19 
\end{DoxySince}


Referenced by \mbox{\hyperlink{group__Eina__Thread__Group_ga85b73a0592645d298a96d62f60732379}{eina\+\_\+thread\+\_\+cancel\+\_\+checkpoint()}}.

