|
|
class CSemaphore
Class implementing a semaphore object. A semaphore is a sinchronization object for multithread programming. The semaphore is a counted resource access controller. The sempahore is built whith a inital count of concurrent thread allowed to take the resource. Every time a thread call Lock() the thread claim one unit of the resource. When no more unit are available a call to Lock() cause the thread wait until another thread call Unlock().
| CSemaphore (long initialCount = 1, long maxCount = 1)
| CSemaphore |
Build the semaphore whit the supplied initialCount ed maxCount parameter.
| ~CSemaphore ()
| ~CSemaphore |
[virtual]
Destroy the semaphore.
| int Lock ()
| Lock |
[virtual]
The calling thread try to lock one item of the resource. The internal resource counter will be decremented. If the counter are 0 the thred go in sleeping state, until someone call Unlock().
Reimplemented from CSyncObject.
| int Unlock ()
| Unlock |
[virtual]
The calling thread release one item of the resource. The internal resource counter will be incremented. Every thread waiting for the resource will be notified to restart.
Reimplemented from CSyncObject.
| int Try ()
| Try |
[virtual]
Try to acquire the locking without really lock the thread. Not yet implemented.
Reimplemented from CSyncObject.
| long getCount ()
| getCount |
[const]
| long getMax ()
| getMax |
[const]
| void setMax (long v)
| setMax |
| pthread_mutex_t mutex | mutex |
[protected]
| pthread_cond_t event | event |
[protected]
| long iCount | iCount |
[protected]
| long mCount | mCount |
[protected]
| Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53. |