\rhead{\bf mc\_MutexLock()}
\noindent
\vspace{5pt}
\rule{6.5in}{0.015in}
\noindent
\phantomsection
{\LARGE \bf mc\_MutexLock()\index{mc\_MutexLock()}}\\
\addcontentsline{toc}{section}{mc\_MutexLock()}
\label{api:mc_MutexLock()}

\noindent
{\bf Synopsis}\\
%{\bf \#include $<$mobilec.h$>$}\\
{\bf int mc\_MutexLock}({\bf int} $id$);\\

\noindent
{\bf Purpose}\\
This function locks a previously initialized Mobile-C synchronization variable 
as a mutex. 
If the mutex is already locked, the function blocks until it is unlocked 
before locking the mutex and continuing. \\

\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}} 
$id$ & The id of the synchronization variable to lock. 
\end{tabular}
\end{description}

\noindent
{\bf Description}\\
This function locks the mutex part of a Mobile-C synchronization variable. 
While this is primarily used to guard a shared resource, the behaviour is 
similar to the standard POSIX mutex locking. 
Note that although a Mobile-C synchronization variable may assume the
role of a mutex, condition variable, or semaphore, once a Mobile-C 
synchronization variable is used as a mutex, it should not be used as anything 
else for the rest of its life cycle.\\ 

\noindent
{\bf Example}\\
Please see Program \vref{prog:mobileagent1_ex5.xml}, Program 
\vref{prog:mobileagent2_ex5.xml}, and Chapter \ref{chap:synchronization}
on page \pageref{chap:synchronization} for more details.\\
\noindent

\noindent
{\bf See Also}\\
mc\_MutexUnlock(), mc\_SyncInit(), mc\_SyncDelete().\\

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