The TROSemaphore class is the cross-platform synchronization object that is a mutex under the hood.
This object is used internally by the TROThreadPool class and is available to users requiring a cross-platform synchronization object. All differences between various platforms and compilers are handled internally inside this class.
- Unit: uROThreadPool.pas
- Ancestry: TROSemaphore
Creates a new instance.
Destroys the underlying synchronization object. This method is called by the destructor and there is no need to call it explicitly. Once destroyed, the underlying synchronization object cannot be recreated.
Decreases the semaphore counter by 1. For Windows it is a ReleaseSemaphore call.
Release (Integer) overload
Decreases the semaphore counter by the specified number. Calls the method above for the required number of times.
procedure Release(Count: Integer)
- Count: Number to decrease the semaphore counter by.
Waits until the semaphore is in the signaled state (counter is greater than zero) or the time-out interval elapses. For Windows it is equivalent to the WaitForSingleObject call.
function WaitFor(Timeout: Cardinal): Boolean
- Timeout: Time to wait in milliseconds.