\doxysection{include/sphinxbase/sbthread.h File Reference}
\label{sbthread_8h}\index{include/sphinxbase/sbthread.h@{include/sphinxbase/sbthread.h}}


Simple portable thread functions.  


{\ttfamily \#include $<$sphinx\+\_\+config.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/cmd\+\_\+ln.\+h$>$}\newline
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \textbf{ sbthread\+\_\+s} \textbf{ sbthread\+\_\+t}
\begin{DoxyCompactList}\small\item\em Thread object. \end{DoxyCompactList}\item 
typedef struct \textbf{ sbmsgq\+\_\+s} \textbf{ sbmsgq\+\_\+t}
\begin{DoxyCompactList}\small\item\em Asynchronous message queue object. \end{DoxyCompactList}\item 
typedef struct \textbf{ sbmtx\+\_\+s} \textbf{ sbmtx\+\_\+t}
\begin{DoxyCompactList}\small\item\em Mutex (critical section) object. \end{DoxyCompactList}\item 
typedef struct \textbf{ sbevent\+\_\+s} \textbf{ sbevent\+\_\+t}
\begin{DoxyCompactList}\small\item\em Event object. \end{DoxyCompactList}\item 
typedef int($\ast$ \textbf{ sbthread\+\_\+main}) (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Entry point for a thread. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ sbthread\+\_\+t} $\ast$ \textbf{ sbthread\+\_\+start} (\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$config, \textbf{ sbthread\+\_\+main} func, void $\ast$arg)
\begin{DoxyCompactList}\small\item\em Start a new thread. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbthread\+\_\+wait} (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Wait for a thread to complete. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ sbthread\+\_\+free} (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Free a thread object. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ cmd\+\_\+ln\+\_\+t} $\ast$ \textbf{ sbthread\+\_\+config} (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Get configuration object from a thread. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ sbthread\+\_\+arg} (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Get argument pointer from a thread. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmsgq\+\_\+t} $\ast$ \textbf{ sbthread\+\_\+msgq} (\textbf{ sbthread\+\_\+t} $\ast$th)
\begin{DoxyCompactList}\small\item\em Get message queue from a thread. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbthread\+\_\+send} (\textbf{ sbthread\+\_\+t} $\ast$th, size\+\_\+t len, void const $\ast$data)
\begin{DoxyCompactList}\small\item\em Send an asynchronous message to a thread. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmsgq\+\_\+t} $\ast$ \textbf{ sbmsgq\+\_\+init} (size\+\_\+t depth)
\begin{DoxyCompactList}\small\item\em Create a message queue. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ sbmsgq\+\_\+free} (\textbf{ sbmsgq\+\_\+t} $\ast$q)
\begin{DoxyCompactList}\small\item\em Free a message queue. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbmsgq\+\_\+send} (\textbf{ sbmsgq\+\_\+t} $\ast$q, size\+\_\+t len, void const $\ast$data)
\begin{DoxyCompactList}\small\item\em Post a message to a queue. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ sbmsgq\+\_\+wait} (\textbf{ sbmsgq\+\_\+t} $\ast$q, size\+\_\+t $\ast$out\+\_\+len, int sec, int nsec)
\begin{DoxyCompactList}\small\item\em Wait for a message from a queue. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmtx\+\_\+t} $\ast$ \textbf{ sbmtx\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em Create a mutex. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbmtx\+\_\+trylock} (\textbf{ sbmtx\+\_\+t} $\ast$mtx)
\begin{DoxyCompactList}\small\item\em Try to acquire a mutex. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbmtx\+\_\+lock} (\textbf{ sbmtx\+\_\+t} $\ast$mtx)
\begin{DoxyCompactList}\small\item\em Acquire a mutex. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbmtx\+\_\+unlock} (\textbf{ sbmtx\+\_\+t} $\ast$mtx)
\begin{DoxyCompactList}\small\item\em Release a mutex. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ sbmtx\+\_\+free} (\textbf{ sbmtx\+\_\+t} $\ast$mtx)
\begin{DoxyCompactList}\small\item\em Dispose of a mutex. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ sbevent\+\_\+t} $\ast$ \textbf{ sbevent\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em Initialize an event. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ sbevent\+\_\+free} (\textbf{ sbevent\+\_\+t} $\ast$evt)
\begin{DoxyCompactList}\small\item\em Free an event. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbevent\+\_\+signal} (\textbf{ sbevent\+\_\+t} $\ast$evt)
\begin{DoxyCompactList}\small\item\em Signal an event. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ sbevent\+\_\+wait} (\textbf{ sbevent\+\_\+t} $\ast$evt, int sec, int nsec)
\begin{DoxyCompactList}\small\item\em Wait for an event to be signalled. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Simple portable thread functions. 

\begin{DoxyAuthor}{Author}
David Huggins-\/\+Daines {\texttt{ dhuggins@cs.\+cmu.\+edu}} 
\end{DoxyAuthor}


Definition in file \textbf{ sbthread.\+h}.



\doxysubsection{Typedef Documentation}
\label{sbthread_8h_a312dae368aa1662b07f199ea802cdefa} 
\index{sbthread.h@{sbthread.h}!sbevent\_t@{sbevent\_t}}
\index{sbevent\_t@{sbevent\_t}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbevent\_t}
{\footnotesize\ttfamily typedef struct \textbf{ sbevent\+\_\+s} \textbf{ sbevent\+\_\+t}}



Event object. 



Definition at line \textbf{ 77} of file \textbf{ sbthread.\+h}.

\label{sbthread_8h_aad7adcc2e5f2fd6d2f429c25a52356ef} 
\index{sbthread.h@{sbthread.h}!sbmsgq\_t@{sbmsgq\_t}}
\index{sbmsgq\_t@{sbmsgq\_t}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmsgq\_t}
{\footnotesize\ttfamily typedef struct \textbf{ sbmsgq\+\_\+s} \textbf{ sbmsgq\+\_\+t}}



Asynchronous message queue object. 



Definition at line \textbf{ 67} of file \textbf{ sbthread.\+h}.

\label{sbthread_8h_a21bc1100c4336693a6f25cdeec40cbec} 
\index{sbthread.h@{sbthread.h}!sbmtx\_t@{sbmtx\_t}}
\index{sbmtx\_t@{sbmtx\_t}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_t}
{\footnotesize\ttfamily typedef struct \textbf{ sbmtx\+\_\+s} \textbf{ sbmtx\+\_\+t}}



Mutex (critical section) object. 



Definition at line \textbf{ 72} of file \textbf{ sbthread.\+h}.

\label{sbthread_8h_a1064427e3f6e981f8321a885c022cc03} 
\index{sbthread.h@{sbthread.h}!sbthread\_main@{sbthread\_main}}
\index{sbthread\_main@{sbthread\_main}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_main}
{\footnotesize\ttfamily typedef int($\ast$ sbthread\+\_\+main) (\textbf{ sbthread\+\_\+t} $\ast$th)}



Entry point for a thread. 



Definition at line \textbf{ 82} of file \textbf{ sbthread.\+h}.

\label{sbthread_8h_a068f6028c760eee1e4eb4655ac7e7424} 
\index{sbthread.h@{sbthread.h}!sbthread\_t@{sbthread\_t}}
\index{sbthread\_t@{sbthread\_t}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_t}
{\footnotesize\ttfamily typedef struct \textbf{ sbthread\+\_\+s} \textbf{ sbthread\+\_\+t}}



Thread object. 



Definition at line \textbf{ 62} of file \textbf{ sbthread.\+h}.



\doxysubsection{Function Documentation}
\label{sbthread_8h_afe8253a0e804a019ad0d8c540eec75af} 
\index{sbthread.h@{sbthread.h}!sbevent\_free@{sbevent\_free}}
\index{sbevent\_free@{sbevent\_free}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbevent\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void sbevent\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ sbevent\+\_\+t} $\ast$}]{evt }\end{DoxyParamCaption})}



Free an event. 



Definition at line \textbf{ 632} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+free()}.

\label{sbthread_8h_a27886ae13186e94058022a36bf10c390} 
\index{sbthread.h@{sbthread.h}!sbevent\_init@{sbevent\_init}}
\index{sbevent\_init@{sbevent\_init}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbevent\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ sbevent\+\_\+t} $\ast$ sbevent\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialize an event. 



Definition at line \textbf{ 611} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ E\+\_\+\+ERROR}, and \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}.

\label{sbthread_8h_a7c01e3e70c2ab8e961d59db84aa5fa68} 
\index{sbthread.h@{sbthread.h}!sbevent\_signal@{sbevent\_signal}}
\index{sbevent\_signal@{sbevent\_signal}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbevent\_signal()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbevent\+\_\+signal (\begin{DoxyParamCaption}\item[{\textbf{ sbevent\+\_\+t} $\ast$}]{evt }\end{DoxyParamCaption})}



Signal an event. 



Definition at line \textbf{ 640} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_ac211760e4dffccf0102db65fb6f2c5b3} 
\index{sbthread.h@{sbthread.h}!sbevent\_wait@{sbevent\_wait}}
\index{sbevent\_wait@{sbevent\_wait}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbevent\_wait()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbevent\+\_\+wait (\begin{DoxyParamCaption}\item[{\textbf{ sbevent\+\_\+t} $\ast$}]{evt,  }\item[{int}]{sec,  }\item[{int}]{nsec }\end{DoxyParamCaption})}



Wait for an event to be signalled. 



Definition at line \textbf{ 652} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_ab1ab59934422a5fac90ce0c4b66ffcc8} 
\index{sbthread.h@{sbthread.h}!sbmsgq\_free@{sbmsgq\_free}}
\index{sbmsgq\_free@{sbmsgq\_free}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmsgq\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void sbmsgq\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ sbmsgq\+\_\+t} $\ast$}]{q }\end{DoxyParamCaption})}



Free a message queue. 



Definition at line \textbf{ 465} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ sbthread\+\_\+free()}.

\label{sbthread_8h_ab3be4993f1561f8c5a203fbf03c26323} 
\index{sbthread.h@{sbthread.h}!sbmsgq\_init@{sbmsgq\_init}}
\index{sbmsgq\_init@{sbmsgq\_init}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmsgq\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmsgq\+\_\+t} $\ast$ sbmsgq\+\_\+init (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{depth }\end{DoxyParamCaption})}



Create a message queue. 


\begin{DoxyParams}{Parameters}
{\em depth} & Depth of the queue. \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 444} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+calloc}, and \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ sbthread\+\_\+start()}.

\label{sbthread_8h_ab0591b5cb626be52dd22edf8fa13a3e3} 
\index{sbthread.h@{sbthread.h}!sbmsgq\_send@{sbmsgq\_send}}
\index{sbmsgq\_send@{sbmsgq\_send}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmsgq\_send()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbmsgq\+\_\+send (\begin{DoxyParamCaption}\item[{\textbf{ sbmsgq\+\_\+t} $\ast$}]{q,  }\item[{size\+\_\+t}]{len,  }\item[{void const $\ast$}]{data }\end{DoxyParamCaption})}



Post a message to a queue. 



Definition at line \textbf{ 475} of file \textbf{ sbthread.\+c}.



Referenced by \textbf{ sbthread\+\_\+send()}.

\label{sbthread_8h_ae279e93b6e4844e8d5b238f33d2e5cf7} 
\index{sbthread.h@{sbthread.h}!sbmsgq\_wait@{sbmsgq\_wait}}
\index{sbmsgq\_wait@{sbmsgq\_wait}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmsgq\_wait()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ sbmsgq\+\_\+wait (\begin{DoxyParamCaption}\item[{\textbf{ sbmsgq\+\_\+t} $\ast$}]{q,  }\item[{size\+\_\+t $\ast$}]{out\+\_\+len,  }\item[{int}]{sec,  }\item[{int}]{nsec }\end{DoxyParamCaption})}



Wait for a message from a queue. 



Definition at line \textbf{ 555} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_aa17a6a93744eb813ca80bf098c69bdba} 
\index{sbthread.h@{sbthread.h}!sbmtx\_free@{sbmtx\_free}}
\index{sbmtx\_free@{sbmtx\_free}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void sbmtx\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ sbmtx\+\_\+t} $\ast$}]{mtx }\end{DoxyParamCaption})}



Dispose of a mutex. 



Definition at line \textbf{ 702} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+free()}.

\label{sbthread_8h_a4b94e8148412072c4487e0fa9c7e644f} 
\index{sbthread.h@{sbthread.h}!sbmtx\_init@{sbmtx\_init}}
\index{sbmtx\_init@{sbmtx\_init}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmtx\+\_\+t} $\ast$ sbmtx\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Create a mutex. 



Definition at line \textbf{ 671} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+calloc}, and \textbf{ ckd\+\_\+free()}.

\label{sbthread_8h_a6615e839f7c8ef3ebb6b288525f002cd} 
\index{sbthread.h@{sbthread.h}!sbmtx\_lock@{sbmtx\_lock}}
\index{sbmtx\_lock@{sbmtx\_lock}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_lock()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbmtx\+\_\+lock (\begin{DoxyParamCaption}\item[{\textbf{ sbmtx\+\_\+t} $\ast$}]{mtx }\end{DoxyParamCaption})}



Acquire a mutex. 



Definition at line \textbf{ 690} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_a3b86c81160360234944737b4eab73125} 
\index{sbthread.h@{sbthread.h}!sbmtx\_trylock@{sbmtx\_trylock}}
\index{sbmtx\_trylock@{sbmtx\_trylock}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_trylock()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbmtx\+\_\+trylock (\begin{DoxyParamCaption}\item[{\textbf{ sbmtx\+\_\+t} $\ast$}]{mtx }\end{DoxyParamCaption})}



Try to acquire a mutex. 



Definition at line \textbf{ 684} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_af65691258c916c68f1b5d000aaea233f} 
\index{sbthread.h@{sbthread.h}!sbmtx\_unlock@{sbmtx\_unlock}}
\index{sbmtx\_unlock@{sbmtx\_unlock}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbmtx\_unlock()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbmtx\+\_\+unlock (\begin{DoxyParamCaption}\item[{\textbf{ sbmtx\+\_\+t} $\ast$}]{mtx }\end{DoxyParamCaption})}



Release a mutex. 



Definition at line \textbf{ 696} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_a1cc5d670b67699cb6e142853b41b1628} 
\index{sbthread.h@{sbthread.h}!sbthread\_arg@{sbthread\_arg}}
\index{sbthread\_arg@{sbthread\_arg}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_arg()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ sbthread\+\_\+arg (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th }\end{DoxyParamCaption})}



Get argument pointer from a thread. 



Definition at line \textbf{ 716} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_afde2c57d63492d027ca4f358336aa419} 
\index{sbthread.h@{sbthread.h}!sbthread\_config@{sbthread\_config}}
\index{sbthread\_config@{sbthread\_config}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_config()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ cmd\+\_\+ln\+\_\+t} $\ast$ sbthread\+\_\+config (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th }\end{DoxyParamCaption})}



Get configuration object from a thread. 



Definition at line \textbf{ 710} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_aa7827b760dfa47d95141f4896698e5c5} 
\index{sbthread.h@{sbthread.h}!sbthread\_free@{sbthread\_free}}
\index{sbthread\_free@{sbthread\_free}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void sbthread\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th }\end{DoxyParamCaption})}



Free a thread object. 



Definition at line \textbf{ 734} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ sbmsgq\+\_\+free()}, and \textbf{ sbthread\+\_\+wait()}.



Referenced by \textbf{ sbthread\+\_\+start()}.

\label{sbthread_8h_ae300b7d1d346e7c292fed274c226a170} 
\index{sbthread.h@{sbthread.h}!sbthread\_msgq@{sbthread\_msgq}}
\index{sbthread\_msgq@{sbthread\_msgq}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_msgq()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ sbmsgq\+\_\+t} $\ast$ sbthread\+\_\+msgq (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th }\end{DoxyParamCaption})}



Get message queue from a thread. 



Definition at line \textbf{ 722} of file \textbf{ sbthread.\+c}.

\label{sbthread_8h_a932830409403ab4a03f0ffefe907551e} 
\index{sbthread.h@{sbthread.h}!sbthread\_send@{sbthread\_send}}
\index{sbthread\_send@{sbthread\_send}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_send()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbthread\+\_\+send (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th,  }\item[{size\+\_\+t}]{len,  }\item[{void const $\ast$}]{data }\end{DoxyParamCaption})}



Send an asynchronous message to a thread. 

Each thread gets a message queue by default, so this is just a wrapper around \doxyref{sbmsgq\+\_\+send()}{p.}{sbthread_8h_ab0591b5cb626be52dd22edf8fa13a3e3}. 

Definition at line \textbf{ 728} of file \textbf{ sbthread.\+c}.



References \textbf{ sbmsgq\+\_\+send()}.

\label{sbthread_8h_a2e9e396919aa1a9d5599626d5c1aef1f} 
\index{sbthread.h@{sbthread.h}!sbthread\_start@{sbthread\_start}}
\index{sbthread\_start@{sbthread\_start}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_start()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ sbthread\+\_\+t} $\ast$ sbthread\+\_\+start (\begin{DoxyParamCaption}\item[{\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$}]{config,  }\item[{\textbf{ sbthread\+\_\+main}}]{func,  }\item[{void $\ast$}]{arg }\end{DoxyParamCaption})}



Start a new thread. 



Definition at line \textbf{ 406} of file \textbf{ sbthread.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ E\+\_\+\+ERROR}, \textbf{ sbmsgq\+\_\+init()}, and \textbf{ sbthread\+\_\+free()}.

\label{sbthread_8h_a09c5c428b02b743c99d20bb2b11d964b} 
\index{sbthread.h@{sbthread.h}!sbthread\_wait@{sbthread\_wait}}
\index{sbthread\_wait@{sbthread\_wait}!sbthread.h@{sbthread.h}}
\doxysubsubsection{sbthread\_wait()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int sbthread\+\_\+wait (\begin{DoxyParamCaption}\item[{\textbf{ sbthread\+\_\+t} $\ast$}]{th }\end{DoxyParamCaption})}



Wait for a thread to complete. 



Definition at line \textbf{ 425} of file \textbf{ sbthread.\+c}.



References \textbf{ E\+\_\+\+ERROR}.



Referenced by \textbf{ sbthread\+\_\+free()}.

