\hypertarget{class_s_c_i_run_1_1_semaphore}{\section{Semaphore Class Reference}
\label{class_s_c_i_run_1_1_semaphore}\index{Semaphore@{Semaphore}}
}


{\ttfamily \#include $<$Semaphore.\-h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_s_c_i_run_1_1_semaphore_ad0e22bb119761beec1907f1d1375dc73}{Semaphore} (const char $\ast$\hyperlink{_boost_graph_example_tests_8cc_a8ad72759d07f18eaf8f6690e5dfb747c}{name}, int count)
\item 
\hyperlink{class_s_c_i_run_1_1_semaphore_a5e0394d4ca6109ccb52b3c1e5cf6c9b5}{$\sim$\-Semaphore} ()
\begin{DoxyCompactList}\small\item\em Destroy the semaphore. \end{DoxyCompactList}\item 
void \hyperlink{class_s_c_i_run_1_1_semaphore_a31c9391e02858dbb7a13fbcbfcb3e067}{up} (int count=1)
\item 
void \hyperlink{class_s_c_i_run_1_1_semaphore_ad852863e348ce912154bde12cfeac589}{down} (int count=1)
\item 
bool \hyperlink{class_s_c_i_run_1_1_semaphore_aed0e93c179823006837817d42977b6c9}{try\-Down} ()
\end{DoxyCompactItemize}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_s_c_i_run_1_1_semaphore_ad0e22bb119761beec1907f1d1375dc73}{\index{S\-C\-I\-Run\-::\-Semaphore@{S\-C\-I\-Run\-::\-Semaphore}!Semaphore@{Semaphore}}
\index{Semaphore@{Semaphore}!SCIRun::Semaphore@{S\-C\-I\-Run\-::\-Semaphore}}
\subsubsection[{Semaphore}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Semaphore} (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{name, }
\item[{int}]{count}
\end{DoxyParamCaption}
)}}\label{class_s_c_i_run_1_1_semaphore_ad0e22bb119761beec1907f1d1375dc73}
Create the semaphore, and setup the initial {\itshape count.\-name} should be a static string which describes the primitive for debugging purposes. \hypertarget{class_s_c_i_run_1_1_semaphore_a5e0394d4ca6109ccb52b3c1e5cf6c9b5}{\index{S\-C\-I\-Run\-::\-Semaphore@{S\-C\-I\-Run\-::\-Semaphore}!$\sim$\-Semaphore@{$\sim$\-Semaphore}}
\index{$\sim$\-Semaphore@{$\sim$\-Semaphore}!SCIRun::Semaphore@{S\-C\-I\-Run\-::\-Semaphore}}
\subsubsection[{$\sim$\-Semaphore}]{\setlength{\rightskip}{0pt plus 5cm}$\sim${\bf Semaphore} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_s_c_i_run_1_1_semaphore_a5e0394d4ca6109ccb52b3c1e5cf6c9b5}


Destroy the semaphore. 



\subsection{Member Function Documentation}
\hypertarget{class_s_c_i_run_1_1_semaphore_ad852863e348ce912154bde12cfeac589}{\index{S\-C\-I\-Run\-::\-Semaphore@{S\-C\-I\-Run\-::\-Semaphore}!down@{down}}
\index{down@{down}!SCIRun::Semaphore@{S\-C\-I\-Run\-::\-Semaphore}}
\subsubsection[{down}]{\setlength{\rightskip}{0pt plus 5cm}void down (
\begin{DoxyParamCaption}
\item[{int}]{count = {\ttfamily 1}}
\end{DoxyParamCaption}
)}}\label{class_s_c_i_run_1_1_semaphore_ad852863e348ce912154bde12cfeac589}
Decrement the semaphore count by {\itshape count}. If the count is zero, this thread will be blocked until another thread calls the {\itshape up} method. The order in which threads will be unblocked is not defined, but implementors should give preference to those threads that have waited the longest. \hypertarget{class_s_c_i_run_1_1_semaphore_aed0e93c179823006837817d42977b6c9}{\index{S\-C\-I\-Run\-::\-Semaphore@{S\-C\-I\-Run\-::\-Semaphore}!try\-Down@{try\-Down}}
\index{try\-Down@{try\-Down}!SCIRun::Semaphore@{S\-C\-I\-Run\-::\-Semaphore}}
\subsubsection[{try\-Down}]{\setlength{\rightskip}{0pt plus 5cm}bool try\-Down (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_s_c_i_run_1_1_semaphore_aed0e93c179823006837817d42977b6c9}
Attempt to decrement the semaphore count by one, but will never block. If the count was zero, {\itshape try\-Down} will return false. Otherwise, {\itshape try\-Down} will return true. \hypertarget{class_s_c_i_run_1_1_semaphore_a31c9391e02858dbb7a13fbcbfcb3e067}{\index{S\-C\-I\-Run\-::\-Semaphore@{S\-C\-I\-Run\-::\-Semaphore}!up@{up}}
\index{up@{up}!SCIRun::Semaphore@{S\-C\-I\-Run\-::\-Semaphore}}
\subsubsection[{up}]{\setlength{\rightskip}{0pt plus 5cm}void up (
\begin{DoxyParamCaption}
\item[{int}]{count = {\ttfamily 1}}
\end{DoxyParamCaption}
)}}\label{class_s_c_i_run_1_1_semaphore_a31c9391e02858dbb7a13fbcbfcb3e067}
Increment the semaphore count, unblocking up to {\itshape count} threads that may be blocked in the {\itshape down} method. 

The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
Core/\-Thread/\-Legacy/\hyperlink{_semaphore_8h}{Semaphore.\-h}\item 
Core/\-Thread/\-Legacy/\hyperlink{_thread__none_8cc}{Thread\-\_\-none.\-cc}\item 
Core/\-Thread/\-Legacy/\hyperlink{_thread__pthreads_8cc}{Thread\-\_\-pthreads.\-cc}\end{DoxyCompactItemize}
