\rhead{\bf MC\_SemaphoreWait()}
\noindent
\vspace{5pt}
\rule{6.5in}{0.015in}
\noindent
\phantomsection
{\LARGE \bf MC\_SemaphoreWait()\index{MC\_SemaphoreWait()}}\\
\addcontentsline{toc}{section}{MC\_SemaphoreWait()}

\noindent
{\bf Synopsis}\\
{\bf \#include $<$libmc.h$>$}\\
{\bf int MC\_SemaphoreWait}({\bf MCAgency\_t} agency, {\bf int} $id$);\\

\noindent
{\bf Purpose}\\
This function allocates one resource from a Mobile-C synchronization semaphore 
variable.\\

\noindent
{\bf Return Value}\\
This function returns 0 on success, or non-zero if the id could not be found.\\

\noindent
{\bf Parameters}
\vspace{-0.1pt}
\begin{description}
\item
\begin{tabular}{p{10 mm}p{145 mm}} 
$agency$ & The agency in which to find the synchronization variable to lock.\\
$id$ & The id of the synchronization variable to lock. 
\end{tabular}
\end{description}

\noindent
{\bf Description}\\
This function allocates one resource from a previously allocated and 
initialized Mobile-C synchronization semaphore. 
If the semaphore resource count is non-zero, the resource is immediately 
allocated. 
If the semaphore resource count is zero, the function blocks until a resource 
is freed before allocating a resource and continuing. 
Note that although a Mobile-C synchronization variable may be used as a mutex, 
condition variable, or semaphore, once it is used as a semaphore, it should 
only be used as a semaphore for the remainder of its life cycle.\\

\noindent
{\bf Example}\\
The MC\_SemaphorePost() function usage is very similar to the other
binary space synchronization functions. Please see Chapter 
\ref{chap:synchronization} on page \pageref{chap:synchronization} for
more information.\\
\noindent
%Compare with output for examples in \CPlot::\Arrow(), \CPlot::\AutoScale(),
%\CPlot::\DisplayTime(), \CPlot::\Label(), \CPlot::\TicsLabel(), 
%\CPlot::\Margins(), \CPlot::\BoundingBoxOffsets(), \CPlot::\TicsDirection(),\linebreak
%\CPlot::\TicsFormat(), and \CPlot::\Title().
%{\footnotesize\verbatiminput{template/example/Data2D.ch}}

\noindent
{\bf See Also}\\
MC\_SemaphorePost(), MC\_SyncInit(), MC\_SyncDelete().\\

%\CPlot::\DataThreeD(), \CPlot::\DataFile(), \CPlot::\Plotting(), \plotxy().\\
