\hypertarget{group__Eina__Thread__Queue__Group}{\section{Thread Queue Group}
\label{group__Eina__Thread__Queue__Group}\index{Thread Queue Group@{Thread Queue Group}}
}


These functions provide simple zero-\/copy message queues for threads.  


\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{struct__Eina__Thread__Queue__Msg}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}
\item 
struct \hyperlink{struct__Eina__Thread__Queue__Msg__Sub}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Queue \hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue}
\begin{DoxyCompactList}\small\item\em This is a uni-\/directional zero-\/copy thread message queue specifically designed with the idea of sending large volumes of messages with no copies from one thread to another (or from/to the mainloop). \end{DoxyCompactList}\item 
typedef struct \\*
\hyperlink{struct__Eina__Thread__Queue__Msg}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg} \hyperlink{group__Eina__Thread__Queue__Group_ga691263b2be42e2b5671448f275687eb5}{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}
\begin{DoxyCompactList}\small\item\em This is the minimal header of every message to be put into an Eina Thread Queue. \end{DoxyCompactList}\item 
typedef struct \\*
\hyperlink{struct__Eina__Thread__Queue__Msg__Sub}{\+\_\+\+Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub} \hyperlink{group__Eina__Thread__Queue__Group_ga6f77f4fb207e88cc9455ef661d3b9f12}{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}
\begin{DoxyCompactList}\small\item\em This is a special message type for Eina Thread Queues that have child queues. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$ \hyperlink{group__Eina__Thread__Queue__Group_gadcb3ccf8211f36644008f4a8c7ecce77}{eina\+\_\+thread\+\_\+queue\+\_\+new} (void)
\begin{DoxyCompactList}\small\item\em Create a new thread queue. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Thread__Queue__Group_ga3797df8c0a9f2dcd86da8c971316e1d3}{eina\+\_\+thread\+\_\+queue\+\_\+free} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq)
\begin{DoxyCompactList}\small\item\em Free a thread queue. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Eina__Thread__Queue__Group_ga44e757fc9b6566f5d209f09a800aa638}{eina\+\_\+thread\+\_\+queue\+\_\+send} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, int size, void $\ast$$\ast$allocref)
\begin{DoxyCompactList}\small\item\em Allocate a message to send down a thread queue. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Thread__Queue__Group_ga338ae6b9a613eb3e227cbab06c94ab4f}{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, void $\ast$allocref)
\begin{DoxyCompactList}\small\item\em Finish sending the allocated message. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, void $\ast$$\ast$allocref)
\begin{DoxyCompactList}\small\item\em Fetch a message from a thread queue. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Thread__Queue__Group_ga1ccc3cfbf71e80596f9825d6c6fd6135}{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, void $\ast$allocref)
\begin{DoxyCompactList}\small\item\em Finish fetching a message from a thread queue. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Eina__Thread__Queue__Group_ga4b9f65958da9fee0e59106d8faf31390}{eina\+\_\+thread\+\_\+queue\+\_\+poll} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, void $\ast$$\ast$allocref)
\begin{DoxyCompactList}\small\item\em Fetch a message from a thread queue, but return immediately if there is none with N\+U\+L\+L. \end{DoxyCompactList}\item 
int \hyperlink{group__Eina__Thread__Queue__Group_ga710c894586159601163826961f0f62b4}{eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get} (const \hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq)
\begin{DoxyCompactList}\small\item\em Get the number of messages on a queue as yet unfetched. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Thread__Queue__Group_gad0903fc27ff93c55b0b432dbbf53491d}{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, \hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq\+\_\+parent)
\begin{DoxyCompactList}\small\item\em Set the parent of a thread queue (make this one a child) \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$ \hyperlink{group__Eina__Thread__Queue__Group_gadb13e550bc7899e83a98b225986d4406}{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get} (const \hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq)
\begin{DoxyCompactList}\small\item\em Get the parent of a thread queue. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Thread__Queue__Group_gae776bfd1d50f9a591ef6230316c4d72e}{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set} (\hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq, int fd)
\begin{DoxyCompactList}\small\item\em Set a file descriptor to write a byte to on a message send. \end{DoxyCompactList}\item 
int \hyperlink{group__Eina__Thread__Queue__Group_gac2389428764e684288e2896c494b5546}{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get} (const \hyperlink{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$thq)
\begin{DoxyCompactList}\small\item\em Get the file descriptor written to on message sends. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
These functions provide simple zero-\/copy message queues for threads. 

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


\subsection{Typedef Documentation}
\hypertarget{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}{\index{Thread Queue Group@{Thread Queue Group}!Eina\+\_\+\+Thread\+\_\+\+Queue@{Eina\+\_\+\+Thread\+\_\+\+Queue}}
\index{Eina\+\_\+\+Thread\+\_\+\+Queue@{Eina\+\_\+\+Thread\+\_\+\+Queue}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{Eina\+\_\+\+Thread\+\_\+\+Queue}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Thread\+\_\+\+Queue}}}\label{group__Eina__Thread__Queue__Group_ga414a1a16533bf9ba8bdf14ffb61c2ed9}


This is a uni-\/directional zero-\/copy thread message queue specifically designed with the idea of sending large volumes of messages with no copies from one thread to another (or from/to the mainloop). 

The ides is that a thread queue is created and then one or more threads send messages in one end and fetch messages on the other end. If you set a parent message queue to 1 or more queues, then this parent will wake up with a sub queue message, indicating which child queue woke up. This can be used to implement the ability to listen to multiple queues at once.

\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_ga691263b2be42e2b5671448f275687eb5}{\index{Thread Queue Group@{Thread Queue Group}!Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg@{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}}
\index{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg@{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg}}}\label{group__Eina__Thread__Queue__Group_ga691263b2be42e2b5671448f275687eb5}


This is the minimal header of every message to be put into an Eina Thread Queue. 

Every message has at least this header at the start of the message data, with payload following. You would put this structure as the first struct member of every message type you have, like Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub does. Messages are always 8 byte aligned within message memory to ensure alignment of all types.

\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_ga6f77f4fb207e88cc9455ef661d3b9f12}{\index{Thread Queue Group@{Thread Queue Group}!Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub@{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}}
\index{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub@{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg\+\_\+\+Sub}}}\label{group__Eina__Thread__Queue__Group_ga6f77f4fb207e88cc9455ef661d3b9f12}


This is a special message type for Eina Thread Queues that have child queues. 

This is the only Message type for a parent message queue and it indicates which child queue was woken up with a new message to read. When this message is retrieved, the caller should then also fetch the message from the inidcated child queue too.

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


\subsection{Function Documentation}
\hypertarget{group__Eina__Thread__Queue__Group_gadcb3ccf8211f36644008f4a8c7ecce77}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+new@{eina\+\_\+thread\+\_\+queue\+\_\+new}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+new@{eina\+\_\+thread\+\_\+queue\+\_\+new}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Thread\+\_\+\+Queue}$\ast$ eina\+\_\+thread\+\_\+queue\+\_\+new (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gadcb3ccf8211f36644008f4a8c7ecce77}


Create a new thread queue. 

\begin{DoxyReturn}{Returns}
A valid new thread queue, or N\+U\+L\+L on failure
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}


References eina\+\_\+semaphore\+\_\+new(), and eina\+\_\+spinlock\+\_\+new().

\hypertarget{group__Eina__Thread__Queue__Group_ga3797df8c0a9f2dcd86da8c971316e1d3}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+free@{eina\+\_\+thread\+\_\+queue\+\_\+free}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+free@{eina\+\_\+thread\+\_\+queue\+\_\+free}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+free}]{\setlength{\rightskip}{0pt plus 5cm}void eina\+\_\+thread\+\_\+queue\+\_\+free (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga3797df8c0a9f2dcd86da8c971316e1d3}


Free a thread queue. 

This frees a thread queue. It must no longer be in use by anything waiting on messages or sending them. Any pending messages will be freed without being processed by a listener.


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to free\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}


References eina\+\_\+semaphore\+\_\+free(), and eina\+\_\+spinlock\+\_\+free().

\hypertarget{group__Eina__Thread__Queue__Group_ga44e757fc9b6566f5d209f09a800aa638}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+send@{eina\+\_\+thread\+\_\+queue\+\_\+send}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+send@{eina\+\_\+thread\+\_\+queue\+\_\+send}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+send}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ eina\+\_\+thread\+\_\+queue\+\_\+send (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{int}]{size, }
\item[{void $\ast$$\ast$}]{allocref}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga44e757fc9b6566f5d209f09a800aa638}


Allocate a message to send down a thread queue. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thred queue to allocate the message on \\
\hline
{\em size} & The size, in bytes, of the message, including standard header \\
\hline
{\em allocref} & A pointer to store a general reference handle for the message \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the message data to fill in
\end{DoxyReturn}
This allocates space for a new message on the message queue, but does not actually trigger the send. For that you will need to call \hyperlink{group__Eina__Thread__Queue__Group_ga338ae6b9a613eb3e227cbab06c94ab4f}{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done()} to complete the send and trigger the other side.

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


References eina\+\_\+spinlock\+\_\+release(), and eina\+\_\+spinlock\+\_\+take().



Referenced by eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done().

\hypertarget{group__Eina__Thread__Queue__Group_ga338ae6b9a613eb3e227cbab06c94ab4f}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done@{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done@{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done}]{\setlength{\rightskip}{0pt plus 5cm}void eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{void $\ast$}]{allocref}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga338ae6b9a613eb3e227cbab06c94ab4f}


Finish sending the allocated message. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue the message was placed on \\
\hline
{\em allocref} & The allocref returned by \hyperlink{group__Eina__Thread__Queue__Group_ga44e757fc9b6566f5d209f09a800aa638}{eina\+\_\+thread\+\_\+queue\+\_\+send()}\\
\hline
\end{DoxyParams}
This completes the send and triggers the thread queue to wake up any listeners.

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


References eina\+\_\+thread\+\_\+queue\+\_\+send(), and eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done().



Referenced by eina\+\_\+thread\+\_\+queue\+\_\+send\+\_\+done().

\hypertarget{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+wait@{eina\+\_\+thread\+\_\+queue\+\_\+wait}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+wait@{eina\+\_\+thread\+\_\+queue\+\_\+wait}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+wait}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ eina\+\_\+thread\+\_\+queue\+\_\+wait (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{void $\ast$$\ast$}]{allocref}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}


Fetch a message from a thread queue. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to fetch the message from \\
\hline
{\em allocref} & A pointer to store a general reference handle for the message \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the message data
\end{DoxyReturn}
This will fetch the next message to read from the thread queue and return a pointer to it. The message is guaranteed to have an initial Eina\+\_\+\+Thread\+\_\+\+Queue\+\_\+\+Msg member that will indicate size of the message as a whole. This function will wait, if no messages are available to read and block until a new message comes in, then return. When the message is finished with, the caller must use \hyperlink{group__Eina__Thread__Queue__Group_ga1ccc3cfbf71e80596f9825d6c6fd6135}{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done()} to indicate they are done.

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


References eina\+\_\+spinlock\+\_\+release(), and eina\+\_\+spinlock\+\_\+take().

\hypertarget{group__Eina__Thread__Queue__Group_ga1ccc3cfbf71e80596f9825d6c6fd6135}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done@{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done@{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done}]{\setlength{\rightskip}{0pt plus 5cm}void eina\+\_\+thread\+\_\+queue\+\_\+wait\+\_\+done (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{void $\ast$}]{allocref}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga1ccc3cfbf71e80596f9825d6c6fd6135}


Finish fetching a message from a thread queue. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue the message was fetched from \\
\hline
{\em allocref} & The allocref returned by \hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait()}\\
\hline
\end{DoxyParams}
This should be used after \hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait()} or \hyperlink{group__Eina__Thread__Queue__Group_ga4b9f65958da9fee0e59106d8faf31390}{eina\+\_\+thread\+\_\+queue\+\_\+poll()} to indicate the caller is done with the message.

\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_ga4b9f65958da9fee0e59106d8faf31390}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+poll@{eina\+\_\+thread\+\_\+queue\+\_\+poll}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+poll@{eina\+\_\+thread\+\_\+queue\+\_\+poll}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+poll}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ eina\+\_\+thread\+\_\+queue\+\_\+poll (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{void $\ast$$\ast$}]{allocref}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga4b9f65958da9fee0e59106d8faf31390}


Fetch a message from a thread queue, but return immediately if there is none with N\+U\+L\+L. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to fetch the message from \\
\hline
{\em allocref} & A pointer to store a general reference handle for the message \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the message data
\end{DoxyReturn}
This is the same as \hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait()}, but if no messages are available for reading, it immediately returns N\+U\+L\+L tot he caller, without waiting for a new message to arrive.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait()}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}


References eina\+\_\+spinlock\+\_\+release(), and eina\+\_\+spinlock\+\_\+take().

\hypertarget{group__Eina__Thread__Queue__Group_ga710c894586159601163826961f0f62b4}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get}]{\setlength{\rightskip}{0pt plus 5cm}int eina\+\_\+thread\+\_\+queue\+\_\+pending\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_ga710c894586159601163826961f0f62b4}


Get the number of messages on a queue as yet unfetched. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to query for pending count \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The number of messages waiting to be fetched
\end{DoxyReturn}
This returns the number of messages waiting to be fetched with \hyperlink{group__Eina__Thread__Queue__Group_gad25bf389aa93c3f7f814ff2015eb27ce}{eina\+\_\+thread\+\_\+queue\+\_\+wait()} or \hyperlink{group__Eina__Thread__Queue__Group_ga4b9f65958da9fee0e59106d8faf31390}{eina\+\_\+thread\+\_\+queue\+\_\+poll()}.

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


References eina\+\_\+spinlock\+\_\+release(), and eina\+\_\+spinlock\+\_\+take().

\hypertarget{group__Eina__Thread__Queue__Group_gad0903fc27ff93c55b0b432dbbf53491d}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set@{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set@{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set}]{\setlength{\rightskip}{0pt plus 5cm}void eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq\+\_\+parent}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gad0903fc27ff93c55b0b432dbbf53491d}


Set the parent of a thread queue (make this one a child) 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to alter the parent of \\
\hline
{\em thq\+\_\+parent} & The new parent to set\\
\hline
\end{DoxyParams}
This sets the parent queue where messages will be reported to. This is how you can listen to multiple queues at once -\/ set multiple queues to have the same parent and then just wait on that one parent. This should be done before any messages are read from or written to the queue. To unset a parent, just set the parent to N\+U\+L\+L.

\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_gadb13e550bc7899e83a98b225986d4406}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Thread\+\_\+\+Queue}$\ast$ eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gadb13e550bc7899e83a98b225986d4406}


Get the parent of a thread queue. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to get the parent of \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The parent thread queue
\end{DoxyReturn}
This gets the paren set by \hyperlink{group__Eina__Thread__Queue__Group_gadb13e550bc7899e83a98b225986d4406}{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+get()}. If no parent is set, N\+U\+L\+L is returned.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Eina__Thread__Queue__Group_gad0903fc27ff93c55b0b432dbbf53491d}{eina\+\_\+thread\+\_\+queue\+\_\+parent\+\_\+set()}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_gae776bfd1d50f9a591ef6230316c4d72e}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set@{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set@{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set}]{\setlength{\rightskip}{0pt plus 5cm}void eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq, }
\item[{int}]{fd}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gae776bfd1d50f9a591ef6230316c4d72e}


Set a file descriptor to write a byte to on a message send. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to set the file descriptor of \\
\hline
{\em fd} & The fd to set, or -\/1 to unset it\\
\hline
\end{DoxyParams}
This sets a file descriptor to write to when a message is written to the thread queue. This can be used to glue a thread queue to something like an Ecore\+\_\+\+Pipe that can wake up the mainloop and call a callbck whenever data is available on the pipe. The number of bytes available will be the number of messages to fetch from the associated thread queue.

You should set this up before anything writes to or reads from this thread queue.

\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
\hypertarget{group__Eina__Thread__Queue__Group_gac2389428764e684288e2896c494b5546}{\index{Thread Queue Group@{Thread Queue Group}!eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get}}
\index{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get@{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get}!Thread Queue Group@{Thread Queue Group}}
\subsubsection[{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get}]{\setlength{\rightskip}{0pt plus 5cm}int eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Eina\+\_\+\+Thread\+\_\+\+Queue} $\ast$}]{thq}
\end{DoxyParamCaption}
)}}\label{group__Eina__Thread__Queue__Group_gac2389428764e684288e2896c494b5546}


Get the file descriptor written to on message sends. 


\begin{DoxyParams}{Parameters}
{\em thq} & The thread queue to get the file descriptor of \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The file descriptor set (or -\/1 if none is set).
\end{DoxyReturn}
This returns the file descriptor set by \hyperlink{group__Eina__Thread__Queue__Group_gae776bfd1d50f9a591ef6230316c4d72e}{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set()} and by default returns -\/1 (no fd set).

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Eina__Thread__Queue__Group_gae776bfd1d50f9a591ef6230316c4d72e}{eina\+\_\+thread\+\_\+queue\+\_\+fd\+\_\+set()}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
1.\+11 
\end{DoxySince}
