ZThread::SemaphoreImpl< List > Class Template Reference

#include <SemaphoreImpl.h>

List of all members.

Public Member Functions

 SemaphoreImpl (int count, unsigned int maxCount, bool checked)
 ~SemaphoreImpl ()
void acquire ()
void release ()
bool tryAcquire (unsigned long timeout)
int count ()


Detailed Description

template<typename List>
class ZThread::SemaphoreImpl< List >

Author:
Eric Crahen <http://www.code-foo.com>
Date:
<2003-07-16T20:03:20-0400>
Version:
2.2.11
The SemaphoreImpl template allows how waiter lists are sorted to be parameteized


Constructor & Destructor Documentation

template<typename List>
ZThread::SemaphoreImpl< List >::SemaphoreImpl ( int  count,
unsigned int  maxCount,
bool  checked 
) [inline]

Create a new SemaphoreImpl. Initialzes one pthreads mutex for internal use.

Exceptions:
Initialization_Exception thrown if resources could not be properly allocated

template<typename List>
ZThread::SemaphoreImpl< List >::~SemaphoreImpl (  ) 

Destroy this SemaphoreImpl and release its resources.


Member Function Documentation

template<typename List>
void ZThread::SemaphoreImpl< List >::acquire (  ) 

Decrement the count, blocking when that count becomes 0 or less.

Exceptions:
Interrupted_Exception thrown when the caller status is interrupted
Synchronization_Exception thrown if there is some other error.

template<typename List>
int ZThread::SemaphoreImpl< List >::count (  ) 

Get the count for the Semaphore

Returns:
int

template<typename List>
void ZThread::SemaphoreImpl< List >::release (  ) 

Increment the count and release a waiter if there are any. If the semaphore is checked, then an exception will be raised if the maximum count is about to be exceeded.

Exceptions:
InvalidOp_Exception thrown if the maximum count is exceeded while the checked flag is set.

template<typename List>
bool ZThread::SemaphoreImpl< List >::tryAcquire ( unsigned long  timeout  ) 

Decrement the count, blocking when it that count is 0 or less. If the timeout expires before the count is raise above 0, the thread will stop blocking and return.

Exceptions:
Interrupted_Exception thrown when the caller status is interrupted
Synchronization_Exception thrown if there is some other error.


The documentation for this class was generated from the following file:
Generated on Wed Aug 30 03:27:49 2006 for SWG EMU by  doxygen 1.4.7