Sophie

Sophie

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

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

\section{ost::Write\-Lock Class Reference}
\label{classost_1_1_write_lock}\index{ost::WriteLock@{ost::WriteLock}}
The {\bf Write\-Lock}{\rm (p.\,\pageref{classost_1_1_write_lock})} class is used to protect a section of code through a {\bf Thread\-Lock}{\rm (p.\,\pageref{classost_1_1_thread_lock})} for \char`\"{}write\char`\"{} access to the member function.Read mode automatic locker for protected access.  


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

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


\subsection{Detailed Description}
The {\bf Write\-Lock}{\rm (p.\,\pageref{classost_1_1_write_lock})} class is used to protect a section of code through a {\bf Thread\-Lock}{\rm (p.\,\pageref{classost_1_1_thread_lock})} for \char`\"{}write\char`\"{} access to the member function.Read mode automatic locker for protected access. 

The {\bf Thread\-Lock}{\rm (p.\,\pageref{classost_1_1_thread_lock})} is automatically released when the object falls out of scope.

A common use is

void func\_\-to\_\-protect() \{ {\bf Write\-Lock}{\rm (p.\,\pageref{classost_1_1_write_lock})} lock(threadlock); ... operation ... \}

NOTE: do not declare variable as \char`\"{}Write\-Lock (threadlock)\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::WriteLock@{ost::Write\-Lock}!WriteLock@{WriteLock}}
\index{WriteLock@{WriteLock}!ost::WriteLock@{ost::Write\-Lock}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Write\-Lock::Write\-Lock ({\bf Thread\-Lock} \& {\em \_\-tl})\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_write_lock_93a59b1f5f09dfdaee18eca85759f86e}


Wait for write access. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-tl}]reference to threadlock to aquire. \end{description}
\end{Desc}
\index{ost::WriteLock@{ost::Write\-Lock}!~WriteLock@{$\sim$WriteLock}}
\index{~WriteLock@{$\sim$WriteLock}!ost::WriteLock@{ost::Write\-Lock}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Write\-Lock::$\sim$Write\-Lock ()\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_write_lock_67a6fef0c02e06cbbf6069715c38cba5}


Post the semaphore automatically. 



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