\doxysection{sbthread.\+h}
\label{sbthread_8h_source}\index{include/sphinxbase/sbthread.h@{include/sphinxbase/sbthread.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ c-\/basic-\/offset:\ 4;\ indent-\/tabs-\/mode:\ nil\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (c)\ 2008\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00043\ \textcolor{preprocessor}{\#ifndef\ \_\_SBTHREAD\_H\_\_}}
\DoxyCodeLine{00044\ \textcolor{preprocessor}{\#define\ \_\_SBTHREAD\_H\_\_}}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \textcolor{preprocessor}{\#include\ <sphinx\_config.h>}}
\DoxyCodeLine{00047\ }
\DoxyCodeLine{00048\ \textcolor{preprocessor}{\#include\ <sphinxbase/sphinxbase\_export.h>}}
\DoxyCodeLine{00049\ \textcolor{preprocessor}{\#include\ <sphinxbase/cmd\_ln.h>}}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00052\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00053\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00054\ \textcolor{preprocessor}{\#if\ 0}}
\DoxyCodeLine{00055\ \textcolor{comment}{/*\ Fool\ Emacs.\ */}}
\DoxyCodeLine{00056\ \}}
\DoxyCodeLine{00057\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00062\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }sbthread\_s\ sbthread\_t;}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00067\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }sbmsgq\_s\ sbmsgq\_t;}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00072\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }sbmtx\_s\ sbmtx\_t;}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00077\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }sbevent\_s\ sbevent\_t;}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{typedef}\ int\ (*sbthread\_main)(sbthread\_t\ *th);}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00087\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00088\ sbthread\_t\ *sbthread\_start(cmd\_ln\_t\ *config,\ sbthread\_main\ func,\ \textcolor{keywordtype}{void}\ *arg);}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00093\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00094\ \textcolor{keywordtype}{int}\ sbthread\_wait(sbthread\_t\ *th);}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00099\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00100\ \textcolor{keywordtype}{void}\ sbthread\_free(sbthread\_t\ *th);}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00105\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00106\ cmd\_ln\_t\ *sbthread\_config(sbthread\_t\ *th);}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00111\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00112\ \textcolor{keywordtype}{void}\ *sbthread\_arg(sbthread\_t\ *th);}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00117\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00118\ sbmsgq\_t\ *sbthread\_msgq(sbthread\_t\ *th);}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00123\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00124\ \textcolor{keywordtype}{int}\ sbthread\_wait(sbthread\_t\ *th);}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00132\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00133\ \textcolor{keywordtype}{int}\ sbthread\_send(sbthread\_t\ *th,\ \textcolor{keywordtype}{size\_t}\ len,\ \textcolor{keywordtype}{void}\ \textcolor{keyword}{const}\ *data);}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00140\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00141\ sbmsgq\_t\ *sbmsgq\_init(\textcolor{keywordtype}{size\_t}\ depth);}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00146\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00147\ \textcolor{keywordtype}{void}\ sbmsgq\_free(sbmsgq\_t\ *q);}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00152\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00153\ \textcolor{keywordtype}{int}\ sbmsgq\_send(sbmsgq\_t\ *q,\ \textcolor{keywordtype}{size\_t}\ len,\ \textcolor{keywordtype}{void}\ \textcolor{keyword}{const}\ *data);}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00158\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00159\ \textcolor{keywordtype}{void}\ *sbmsgq\_wait(sbmsgq\_t\ *q,\ \textcolor{keywordtype}{size\_t}\ *out\_len,\ \textcolor{keywordtype}{int}\ sec,\ \textcolor{keywordtype}{int}\ nsec);}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00164\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00165\ sbmtx\_t\ *sbmtx\_init(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00166\ }
\DoxyCodeLine{00170\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00171\ \textcolor{keywordtype}{int}\ sbmtx\_trylock(sbmtx\_t\ *mtx);}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00176\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00177\ \textcolor{keywordtype}{int}\ sbmtx\_lock(sbmtx\_t\ *mtx);}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00182\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00183\ \textcolor{keywordtype}{int}\ sbmtx\_unlock(sbmtx\_t\ *mtx);}
\DoxyCodeLine{00184\ }
\DoxyCodeLine{00188\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00189\ \textcolor{keywordtype}{void}\ sbmtx\_free(sbmtx\_t\ *mtx);}
\DoxyCodeLine{00190\ }
\DoxyCodeLine{00194\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00195\ sbevent\_t\ *sbevent\_init(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00196\ }
\DoxyCodeLine{00200\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00201\ \textcolor{keywordtype}{void}\ sbevent\_free(sbevent\_t\ *evt);}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00206\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00207\ \textcolor{keywordtype}{int}\ sbevent\_signal(sbevent\_t\ *evt);}
\DoxyCodeLine{00208\ }
\DoxyCodeLine{00212\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00213\ \textcolor{keywordtype}{int}\ sbevent\_wait(sbevent\_t\ *evt,\ \textcolor{keywordtype}{int}\ sec,\ \textcolor{keywordtype}{int}\ nsec);}
\DoxyCodeLine{00214\ }
\DoxyCodeLine{00215\ }
\DoxyCodeLine{00216\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00217\ \}}
\DoxyCodeLine{00218\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00219\ }
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00221\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{/*\ \_\_SBTHREAD\_H\_\_\ */}\textcolor{preprocessor}{}}

\end{DoxyCode}
