SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
Semaphore Class Reference

#include <Semaphore.h>

Public Member Functions

 Semaphore (const char *name, int count)
 
 ~Semaphore ()
 Destroy the semaphore. More...
 
void up (int count=1)
 
void down (int count=1)
 
bool tryDown ()
 

Constructor & Destructor Documentation

Semaphore ( const char *  name,
int  count 
)

Create the semaphore, and setup the initial count.name should be a static string which describes the primitive for debugging purposes.

~Semaphore ( )

Destroy the semaphore.

Member Function Documentation

void down ( int  count = 1)

Decrement the semaphore count by count. If the count is zero, this thread will be blocked until another thread calls the 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.

bool tryDown ( )

Attempt to decrement the semaphore count by one, but will never block. If the count was zero, tryDown will return false. Otherwise, tryDown will return true.

void up ( int  count = 1)

Increment the semaphore count, unblocking up to count threads that may be blocked in the down method.


The documentation for this class was generated from the following files: