\hypertarget{group__Ecore__Idle__Group}{\section{Ecore Idle functions}
\label{group__Ecore__Idle__Group}\index{Ecore Idle functions@{Ecore Idle functions}}
}


The idler functionality in Ecore allows for callbacks to be called when the program isn't handling \hyperlink{group__Ecore__Event__Group}{events}, \hyperlink{group__Ecore__Timer__Group}{timers} or \hyperlink{group__Ecore__FD__Handler__Group}{fd handlers}.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Ecore__Idle__Group_ga2cc50b0957bf0eaf0c024a7c053fa1dc}{typedef \hyperlink{group__Eo_ga9f3010a50b61a892d41f4ec2bda73f4c}{Eo} \hyperlink{group__Ecore__Idle__Group_ga2cc50b0957bf0eaf0c024a7c053fa1dc}{Ecore\+\_\+\+Idler}}\label{group__Ecore__Idle__Group_ga2cc50b0957bf0eaf0c024a7c053fa1dc}

\begin{DoxyCompactList}\small\item\em A handle for idlers. \end{DoxyCompactList}\item 
\hypertarget{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}{typedef \hyperlink{group__Eo_ga9f3010a50b61a892d41f4ec2bda73f4c}{Eo} \hyperlink{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}{Ecore\+\_\+\+Idle\+\_\+\+Enterer}}\label{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}

\begin{DoxyCompactList}\small\item\em A handle for idle enterers. \end{DoxyCompactList}\item 
\hypertarget{group__Ecore__Idle__Group_ga0481e5c5dda1fa73f4e0296ef069692b}{typedef \hyperlink{group__Eo_ga9f3010a50b61a892d41f4ec2bda73f4c}{Eo} \hyperlink{group__Ecore__Idle__Group_ga0481e5c5dda1fa73f4e0296ef069692b}{Ecore\+\_\+\+Idle\+\_\+\+Exiter}}\label{group__Ecore__Idle__Group_ga0481e5c5dda1fa73f4e0296ef069692b}

\begin{DoxyCompactList}\small\item\em A handle for idle exiters. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Ecore__Idle__Group_ga2cc50b0957bf0eaf0c024a7c053fa1dc}{Ecore\+\_\+\+Idler} $\ast$ \hyperlink{group__Ecore__Idle__Group_ga048ed35688c416f1f495912a900e9297}{ecore\+\_\+idler\+\_\+add} (\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Add an idler handler. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__Idle__Group_gaf7b5ec4cc0d26179c1b5e3ee907e5d58}{ecore\+\_\+idler\+\_\+del} (\hyperlink{group__Ecore__Idle__Group_ga2cc50b0957bf0eaf0c024a7c053fa1dc}{Ecore\+\_\+\+Idler} $\ast$idler)
\begin{DoxyCompactList}\small\item\em Delete an idler callback from the list to be executed. \end{DoxyCompactList}\item 
\hyperlink{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}{Ecore\+\_\+\+Idle\+\_\+\+Enterer} $\ast$ \hyperlink{group__Ecore__Idle__Group_ga0805b9840716bd08ae44956dba8de3e6}{ecore\+\_\+idle\+\_\+enterer\+\_\+add} (\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Add an idle enterer handler. \end{DoxyCompactList}\item 
\hyperlink{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}{Ecore\+\_\+\+Idle\+\_\+\+Enterer} $\ast$ \hyperlink{group__Ecore__Idle__Group_ga6aa00afaecb0a5a29add3bb92f534a0d}{ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add} (\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Add an idle enterer handler at the start of the list so it gets called earlier than others. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__Idle__Group_ga7e1106729c49d0cd714ef58e0343470c}{ecore\+\_\+idle\+\_\+enterer\+\_\+del} (\hyperlink{group__Ecore__Idle__Group_ga361e0801c2d510e54e92b54968863ca3}{Ecore\+\_\+\+Idle\+\_\+\+Enterer} $\ast$idle\+\_\+enterer)
\begin{DoxyCompactList}\small\item\em Delete an idle enterer callback. \end{DoxyCompactList}\item 
\hyperlink{group__Ecore__Idle__Group_ga0481e5c5dda1fa73f4e0296ef069692b}{Ecore\+\_\+\+Idle\+\_\+\+Exiter} $\ast$ \hyperlink{group__Ecore__Idle__Group_ga4bbd02660dd2b36a2da262a9bda3dfb4}{ecore\+\_\+idle\+\_\+exiter\+\_\+add} (\hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Add an idle exiter handler. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__Idle__Group_ga89b7d6e94230fcbc331258f7aedf6010}{ecore\+\_\+idle\+\_\+exiter\+\_\+del} (\hyperlink{group__Ecore__Idle__Group_ga0481e5c5dda1fa73f4e0296ef069692b}{Ecore\+\_\+\+Idle\+\_\+\+Exiter} $\ast$idle\+\_\+exiter)
\begin{DoxyCompactList}\small\item\em Delete an idle exiter handler from the list to be run on exiting idle state. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The idler functionality in Ecore allows for callbacks to be called when the program isn't handling \hyperlink{group__Ecore__Event__Group}{events}, \hyperlink{group__Ecore__Timer__Group}{timers} or \hyperlink{group__Ecore__FD__Handler__Group}{fd handlers}. 

There are three types of idlers\+: Enterers, Idlers(proper) and Exiters. They are called, respectively, when the program is about to enter an idle state, when the program is in an idle state and when the program has just left an idle state and will begin processing \hyperlink{group__Ecore__Event__Group}{events}, \hyperlink{group__Ecore__Timer__Group}{timers} or \hyperlink{group__Ecore__FD__Handler__Group}{fd handlers}.

Enterer callbacks are good for updating your program's state, if it has a state engine. Once all of the enterer handlers are called, the program will enter a \char`\"{}sleeping\char`\"{} state.

Idler callbacks are called when the main loop has called all enterer handlers. They are useful for interfaces that require polling and timers would be too slow to use.

Exiter callbacks are called when the main loop wakes up from an idle state.

If no idler callbacks are specified, then the process literally goes to sleep. Otherwise, the idler callbacks are called continuously while the loop is \char`\"{}idle\char`\"{}, using as much C\+P\+U as is available to the process.

\begin{DoxyNote}{Note}
Idle state doesn't mean that the {\bfseries program} is idle, but that the {\bfseries main loop} is idle. It doesn't have any timers, events, fd handlers or anything else to process (which in most {\itshape event driven} programs also means that the {\bfseries program} is idle too, but it's not a rule). The program itself may be doing a lot of processing in the idler, or in another thread, for example.
\end{DoxyNote}
Example with functions that deal with idle state\+:

\begin{DoxyItemize}
\item \hyperlink{ecore_idler_example_c}{ecore idle state -\/ Idlers, enterers and exiters} \end{DoxyItemize}


\subsection{Function Documentation}
\hypertarget{group__Ecore__Idle__Group_ga048ed35688c416f1f495912a900e9297}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idler\+\_\+add@{ecore\+\_\+idler\+\_\+add}}
\index{ecore\+\_\+idler\+\_\+add@{ecore\+\_\+idler\+\_\+add}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idler\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Idler}$\ast$ ecore\+\_\+idler\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Task\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga048ed35688c416f1f495912a900e9297}


Add an idler handler. 


\begin{DoxyParams}{Parameters}
{\em func} & The function to call when idling. \\
\hline
{\em data} & The data to be passed to this {\ttfamily func} call. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A idler handle if successfully added, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
Add an idler handle to the event loop, returning a handle on success and {\ttfamily N\+U\+L\+L} otherwise. The function {\ttfamily func} will be called repeatedly while no other events are ready to be processed, as long as it returns {\ttfamily 1} (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W). A return of {\ttfamily 0} (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L) deletes the idler.

Idlers are useful for progressively prossessing data without blocking. 

Referenced by eldbus\+\_\+name\+\_\+owner\+\_\+changed\+\_\+callback\+\_\+add(), and eldbus\+\_\+service\+\_\+property\+\_\+changed().

\hypertarget{group__Ecore__Idle__Group_gaf7b5ec4cc0d26179c1b5e3ee907e5d58}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idler\+\_\+del@{ecore\+\_\+idler\+\_\+del}}
\index{ecore\+\_\+idler\+\_\+del@{ecore\+\_\+idler\+\_\+del}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idler\+\_\+del}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+idler\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Idler} $\ast$}]{idler}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_gaf7b5ec4cc0d26179c1b5e3ee907e5d58}


Delete an idler callback from the list to be executed. 


\begin{DoxyParams}{Parameters}
{\em idler} & The handle of the idler callback to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer passed to the idler callback on success, {\ttfamily N\+U\+L\+L} otherwise. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.



Referenced by eldbus\+\_\+name\+\_\+owner\+\_\+changed\+\_\+callback\+\_\+del(), eldbus\+\_\+service\+\_\+object\+\_\+manager\+\_\+attach(), and ethumb\+\_\+free().

\hypertarget{group__Ecore__Idle__Group_ga0805b9840716bd08ae44956dba8de3e6}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idle\+\_\+enterer\+\_\+add@{ecore\+\_\+idle\+\_\+enterer\+\_\+add}}
\index{ecore\+\_\+idle\+\_\+enterer\+\_\+add@{ecore\+\_\+idle\+\_\+enterer\+\_\+add}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idle\+\_\+enterer\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Idle\+\_\+\+Enterer}$\ast$ ecore\+\_\+idle\+\_\+enterer\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Task\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga0805b9840716bd08ae44956dba8de3e6}


Add an idle enterer handler. 


\begin{DoxyParams}{Parameters}
{\em func} & The function to call when entering an idle state. \\
\hline
{\em data} & The data to be passed to the {\ttfamily func} call \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A handle to the idle enterer callback if successful. Otherwise, N\+U\+L\+L is returned. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
The function func will be called every time the main loop is entering idle state, as long as it returns 1 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W). A return of 0 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L) deletes the idle enterer. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_idler_example_8c-example}{ecore\+\_\+idler\+\_\+example.\+c}.\end{Desc}


Referenced by ecore\+\_\+drm\+\_\+device\+\_\+open(), ecore\+\_\+evas\+\_\+init(), ecore\+\_\+wl\+\_\+init(), and ecore\+\_\+x\+\_\+init().

\hypertarget{group__Ecore__Idle__Group_ga6aa00afaecb0a5a29add3bb92f534a0d}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add@{ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add}}
\index{ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add@{ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Idle\+\_\+\+Enterer}$\ast$ ecore\+\_\+idle\+\_\+enterer\+\_\+before\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Task\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga6aa00afaecb0a5a29add3bb92f534a0d}


Add an idle enterer handler at the start of the list so it gets called earlier than others. 


\begin{DoxyParams}{Parameters}
{\em func} & The function to call when entering an idle state. \\
\hline
{\em data} & The data to be passed to the {\ttfamily func} call \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A handle to the idle enterer callback if successful. Otherwise, N\+U\+L\+L is returned. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
The function func will be called every time the main loop is entering idle state, as long as it returns 1 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W). A return of 0 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L) deletes the idle enterer. 
\end{DoxyNote}
\hypertarget{group__Ecore__Idle__Group_ga7e1106729c49d0cd714ef58e0343470c}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idle\+\_\+enterer\+\_\+del@{ecore\+\_\+idle\+\_\+enterer\+\_\+del}}
\index{ecore\+\_\+idle\+\_\+enterer\+\_\+del@{ecore\+\_\+idle\+\_\+enterer\+\_\+del}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idle\+\_\+enterer\+\_\+del}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+idle\+\_\+enterer\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Idle\+\_\+\+Enterer} $\ast$}]{idle\+\_\+enterer}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga7e1106729c49d0cd714ef58e0343470c}


Delete an idle enterer callback. 


\begin{DoxyParams}{Parameters}
{\em idle\+\_\+enterer} & The idle enterer to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer passed to the idler enterer callback on success. N\+U\+L\+L otherwise. 
\end{DoxyReturn}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_idler_example_8c-example}{ecore\+\_\+idler\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.



Referenced by ecore\+\_\+evas\+\_\+shutdown().

\hypertarget{group__Ecore__Idle__Group_ga4bbd02660dd2b36a2da262a9bda3dfb4}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idle\+\_\+exiter\+\_\+add@{ecore\+\_\+idle\+\_\+exiter\+\_\+add}}
\index{ecore\+\_\+idle\+\_\+exiter\+\_\+add@{ecore\+\_\+idle\+\_\+exiter\+\_\+add}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idle\+\_\+exiter\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Idle\+\_\+\+Exiter}$\ast$ ecore\+\_\+idle\+\_\+exiter\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Task\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga4bbd02660dd2b36a2da262a9bda3dfb4}


Add an idle exiter handler. 


\begin{DoxyParams}{Parameters}
{\em func} & The function to call when exiting an idle state. \\
\hline
{\em data} & The data to be passed to the {\ttfamily func} call \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A handle to the idle exiter callback on success. N\+U\+L\+L otherwise. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
The function func will be called every time the main loop is exiting idle state, as long as it returns 1 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W). A return of 0 (or E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L) deletes the idle exiter. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_idler_example_8c-example}{ecore\+\_\+idler\+\_\+example.\+c}.\end{Desc}
\hypertarget{group__Ecore__Idle__Group_ga89b7d6e94230fcbc331258f7aedf6010}{\index{Ecore Idle functions@{Ecore Idle functions}!ecore\+\_\+idle\+\_\+exiter\+\_\+del@{ecore\+\_\+idle\+\_\+exiter\+\_\+del}}
\index{ecore\+\_\+idle\+\_\+exiter\+\_\+del@{ecore\+\_\+idle\+\_\+exiter\+\_\+del}!Ecore Idle functions@{Ecore Idle functions}}
\subsubsection[{ecore\+\_\+idle\+\_\+exiter\+\_\+del}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+idle\+\_\+exiter\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Idle\+\_\+\+Exiter} $\ast$}]{idle\+\_\+exiter}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Idle__Group_ga89b7d6e94230fcbc331258f7aedf6010}


Delete an idle exiter handler from the list to be run on exiting idle state. 


\begin{DoxyParams}{Parameters}
{\em idle\+\_\+exiter} & The idle exiter to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer that was being being passed to the handler if successful. N\+U\+L\+L otherwise. 
\end{DoxyReturn}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_idler_example_8c-example}{ecore\+\_\+idler\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.

