Implements a synchronization counter (semaphore).
class SyncCounter( [count] )
init | Implements a synchronization counter (semaphore). |
post() | Releases the counter or increases the counter by more than one. |
Implements a synchronization counter (semaphore).
This class implements a synchronization counter, commonly known as "semaphore", which provides the following behavior:
We have adopted the "counter" name rather than the more common "semaphore" to avoid confusion with the Semaphore class used for coroutines, and also because the post semantic is merged with the release method.
Implements a synchronization counter (semaphore).
init SyncCounter( [count] )
count | Initial counter value (defaults to 0). |
This class implements a synchronization counter, commonly known as "semaphore", which provides the following behavior:
We have adopted the "counter" name rather than the more common "semaphore" to avoid confusion with the Semaphore class used for coroutines, and also because the post semantic is merged with the release method.
Releases the counter or increases the counter by more than one.
SyncCounter.post( [count] )
count | The number of signalations to be posted to this semaphore. |
This method acts as release(), but it can be provided an optional parameter to give more than one thread the ability to acquire this structure.
It is not possible to use this method to reduce the internal count.