\hypertarget{group__Ecore__Poller__Group}{\section{Ecore Poll functions}
\label{group__Ecore__Poller__Group}\index{Ecore Poll functions@{Ecore Poll functions}}
}


Ecore poller provides infrastructure for the creation of pollers.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Ecore__Poller__Group_ga6f43e4d4e2b272f21d01d9cb612c692a}{typedef enum \hyperlink{group__Ecore__Poller__Group_ga50dcd2652ba68fe4aac51c70c3fa1e2c}{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type} {\bfseries Ecore\+\_\+\+Poller\+\_\+\+Type}}\label{group__Ecore__Poller__Group_ga6f43e4d4e2b272f21d01d9cb612c692a}

\item 
\hypertarget{group__Ecore__Poller__Group_ga437f925a7a71ee670bbf8cdd4a258f53}{typedef \hyperlink{group__Eo_ga9f3010a50b61a892d41f4ec2bda73f4c}{Eo} \hyperlink{group__Ecore__Poller__Group_ga437f925a7a71ee670bbf8cdd4a258f53}{Ecore\+\_\+\+Poller}}\label{group__Ecore__Poller__Group_ga437f925a7a71ee670bbf8cdd4a258f53}

\begin{DoxyCompactList}\small\item\em A handle for pollers. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group__Ecore__Poller__Group_ga50dcd2652ba68fe4aac51c70c3fa1e2c}{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type} \{ \hyperlink{group__Ecore__Poller__Group_gga50dcd2652ba68fe4aac51c70c3fa1e2ca022dfec751388e380cf01621bd0f797f}{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E} = 0
 \}
\begin{DoxyCompactList}\small\item\em Defines the frequency of ticks for the poller. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set} (Ecore\+\_\+\+Poller\+\_\+\+Type type, double poll\+\_\+time)
\begin{DoxyCompactList}\small\item\em Sets the time(in seconds) between ticks for the given poller type. \end{DoxyCompactList}\item 
double \hyperlink{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get} (Ecore\+\_\+\+Poller\+\_\+\+Type type)
\begin{DoxyCompactList}\small\item\em Gets the time(in seconds) between ticks for the given poller type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Ecore__Poller__Group_ga437f925a7a71ee670bbf8cdd4a258f53}{Ecore\+\_\+\+Poller} $\ast$ \hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\+\_\+poller\+\_\+add} (Ecore\+\_\+\+Poller\+\_\+\+Type type, int interval, \hyperlink{group__Ecore__Main__Loop__Group_ga8a36ef1ac24bfa317a7826617264e530}{Ecore\+\_\+\+Task\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Creates a poller to call the given function at a particular tick interval. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}{ecore\+\_\+poller\+\_\+del} (\hyperlink{group__Ecore__Poller__Group_ga437f925a7a71ee670bbf8cdd4a258f53}{Ecore\+\_\+\+Poller} $\ast$poller)
\begin{DoxyCompactList}\small\item\em Delete the specified poller from the timer list. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Ecore poller provides infrastructure for the creation of pollers. 

Pollers are, in essence, callbacks that share a single timer per type. Because not all pollers need to be called at the same frequency the user may specify the frequency in ticks(each expiration of the shared timer is called a tick, in ecore poller parlance) for each added poller. Ecore pollers should only be used when the poller doesn't have specific requirements on the exact times to poll.

This architecture means that the main loop is only woken up once to handle all pollers of that type, this will save power as the C\+P\+U has more of a chance to go into a low power state the longer it is asleep for, so this should be used in situations where power usage is a concern.

For now only 1 core poller type is supported\+: E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E, the default interval for E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E is 0.\+125(or 1/8th) second.

The creation of a poller is extremely simple and only requires one line\+: 
\begin{DoxyCode}
\hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\_poller\_add}(\hyperlink{group__Ecore__Poller__Group_gga50dcd2652ba68fe4aac51c70c3fa1e2ca022dfec751388e380cf01621bd0f797f}{ECORE\_POLLER\_CORE}, 1, my\_poller\_function, NULL);
\end{DoxyCode}
 This sample creates a poller to call {\ttfamily my\+\_\+poller\+\_\+function} at every tick with {\ttfamily N\+U\+L\+L} as data.

Example\+: \begin{DoxyItemize}
\item \hyperlink{ecore_poller_example_c}{ecore poller -\/ Repetitive polling tasks} \end{DoxyItemize}


\subsection{Enumeration Type Documentation}
\hypertarget{group__Ecore__Poller__Group_ga50dcd2652ba68fe4aac51c70c3fa1e2c}{\index{Ecore Poll functions@{Ecore Poll functions}!\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type@{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type}}
\index{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type@{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection[{\+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \+\_\+\+Ecore\+\_\+\+Poller\+\_\+\+Type}}}\label{group__Ecore__Poller__Group_ga50dcd2652ba68fe4aac51c70c3fa1e2c}


Defines the frequency of ticks for the poller. 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E@{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E}!Ecore Poll functions@{Ecore Poll functions}}\index{Ecore Poll functions@{Ecore Poll functions}!E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E@{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E}}\item[{\em 
\hypertarget{group__Ecore__Poller__Group_gga50dcd2652ba68fe4aac51c70c3fa1e2ca022dfec751388e380cf01621bd0f797f}{E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E}\label{group__Ecore__Poller__Group_gga50dcd2652ba68fe4aac51c70c3fa1e2ca022dfec751388e380cf01621bd0f797f}
}]The core poller interval. \end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}{\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}}
\index{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection[{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set}]{\setlength{\rightskip}{0pt plus 5cm}void ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+set (
\begin{DoxyParamCaption}
\item[{Ecore\+\_\+\+Poller\+\_\+\+Type}]{type, }
\item[{double}]{poll\+\_\+time}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Poller__Group_ga466dff0c7fb7eb0f5b4e5a3825fa10ac}


Sets the time(in seconds) between ticks for the given poller type. 


\begin{DoxyParams}{Parameters}
{\em type} & The poller type to adjust. \\
\hline
{\em poll\+\_\+time} & The time(in seconds) between ticks of the timer.\\
\hline
\end{DoxyParams}
This will adjust the time between ticks of the given timer type defined by {\ttfamily type} to the time period defined by {\ttfamily poll\+\_\+time}. \begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+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, and E\+R\+R.

\hypertarget{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}{\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}}
\index{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get@{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection[{ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get}]{\setlength{\rightskip}{0pt plus 5cm}double ecore\+\_\+poller\+\_\+poll\+\_\+interval\+\_\+get (
\begin{DoxyParamCaption}
\item[{Ecore\+\_\+\+Poller\+\_\+\+Type}]{type}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Poller__Group_ga72031680ab8f5385639389ac0591e272}


Gets the time(in seconds) between ticks for the given poller type. 


\begin{DoxyParams}{Parameters}
{\em type} & The poller type to query. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The time in seconds between ticks of the poller timer.
\end{DoxyReturn}
This will get the time between ticks of the specified poller timer. 

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.

\hypertarget{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+add@{ecore\+\_\+poller\+\_\+add}}
\index{ecore\+\_\+poller\+\_\+add@{ecore\+\_\+poller\+\_\+add}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection[{ecore\+\_\+poller\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Poller}$\ast$ ecore\+\_\+poller\+\_\+add (
\begin{DoxyParamCaption}
\item[{Ecore\+\_\+\+Poller\+\_\+\+Type}]{type, }
\item[{int}]{interval, }
\item[{{\bf Ecore\+\_\+\+Task\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}


Creates a poller to call the given function at a particular tick interval. 


\begin{DoxyParams}{Parameters}
{\em type} & The ticker type to attach the poller to. Must be E\+C\+O\+R\+E\+\_\+\+P\+O\+L\+L\+E\+R\+\_\+\+C\+O\+R\+E. \\
\hline
{\em interval} & The poll interval. \\
\hline
{\em func} & The poller function. \\
\hline
{\em data} & Data to pass to {\itshape func} when it is called. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A poller object on success, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
This function adds {\itshape func} as a poller callback that will be called every {\itshape interval} ticks together with other pollers of type {\itshape type}. {\itshape func} will be passed the {\ttfamily data} pointer as a parameter.

The {\ttfamily interval} must be between 1 and 32768 inclusive, and must be a power of 2 (i.\+e. 1, 2, 4, 8, 16, ... 16384, 32768). The exact tick in which {\itshape func} will be called is undefined, as only the interval between calls can be defined. Ecore will endeavor to keep pollers synchronized and to call as many in 1 wakeup event as possible. If {\itshape interval} is not a power of two, the closest power of 2 greater than {\itshape interval} will be used.

When the poller {\ttfamily func} is called, it must return a value of either \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W(or 1)} or \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L(or 0)}. If it returns 1, it will be called again at the next tick, or if it returns 0 it will be deleted automatically making any references/handles for it invalid. \begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}.\end{Desc}
\hypertarget{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}{\index{Ecore Poll functions@{Ecore Poll functions}!ecore\+\_\+poller\+\_\+del@{ecore\+\_\+poller\+\_\+del}}
\index{ecore\+\_\+poller\+\_\+del@{ecore\+\_\+poller\+\_\+del}!Ecore Poll functions@{Ecore Poll functions}}
\subsubsection[{ecore\+\_\+poller\+\_\+del}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+poller\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Poller} $\ast$}]{poller}
\end{DoxyParamCaption}
)}}\label{group__Ecore__Poller__Group_ga52e6245cfbceaed9b721a1addd29d311}


Delete the specified poller from the timer list. 


\begin{DoxyParams}{Parameters}
{\em poller} & The poller to delete. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer set for the timer when \hyperlink{group__Ecore__Poller__Group_gadd8ee7135864da4313bc88faa0a2d7c9}{ecore\+\_\+poller\+\_\+add} was called on success, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
\begin{DoxyNote}{Note}
{\itshape poller} must be a valid handle. If the poller function has already returned 0, the handle is no longer valid (and does not need to be deleted). 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_poller_example_8c-example}{ecore\+\_\+poller\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, E\+I\+N\+A\+\_\+\+I\+N\+L\+I\+S\+T\+\_\+\+G\+E\+T, eina\+\_\+inlist\+\_\+remove(), and 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.

