Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 740

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Semaphore\-Lock Class Reference}
\label{classost_1_1_semaphore_lock}\index{ost::SemaphoreLock@{ost::SemaphoreLock}}
The {\bf Semaphore\-Lock}{\rm (p.\,\pageref{classost_1_1_semaphore_lock})} class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently.Semaphore automatic locker for protected access.  


{\tt \#include $<$thread.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Semaphore\-Lock} ({\bf Semaphore} \&\_\-sem)
\begin{CompactList}\small\item\em Wait for the semaphore. \item\end{CompactList}\item 
{\bf $\sim$Semaphore\-Lock} ()
\begin{CompactList}\small\item\em Post the semaphore automatically. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
The {\bf Semaphore\-Lock}{\rm (p.\,\pageref{classost_1_1_semaphore_lock})} class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently.Semaphore automatic locker for protected access. 

A common use is

void func\_\-to\_\-protect() \{ {\bf Semaphore\-Lock}{\rm (p.\,\pageref{classost_1_1_semaphore_lock})} lock(semaphore); ... operation ... \}

NOTE: do not declare variable as \char`\"{}Semaohore\-Lock (semaphore)\char`\"{}, the mutex will be released at statement end.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@gnu.org}$>$ \end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::SemaphoreLock@{ost::Semaphore\-Lock}!SemaphoreLock@{SemaphoreLock}}
\index{SemaphoreLock@{SemaphoreLock}!ost::SemaphoreLock@{ost::Semaphore\-Lock}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Semaphore\-Lock::Semaphore\-Lock ({\bf Semaphore} \& {\em \_\-sem})\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_semaphore_lock_db34354071ac2005870fb78926887a05}


Wait for the semaphore. 

\index{ost::SemaphoreLock@{ost::Semaphore\-Lock}!~SemaphoreLock@{$\sim$SemaphoreLock}}
\index{~SemaphoreLock@{$\sim$SemaphoreLock}!ost::SemaphoreLock@{ost::Semaphore\-Lock}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Semaphore\-Lock::$\sim$Semaphore\-Lock ()\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_semaphore_lock_59bf7e09b61fd3b900070841fae86597}


Post the semaphore automatically. 



The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf thread.h}\end{CompactItemize}