Semaphore.AcquireSemaphoreWithAutoReleaser
- Updated2024-10-09
- 1 minute(s) read
Semaphore.AcquireSemaphoreWithAutoReleaser
Syntax
Semaphore.AcquireSemaphoreWithAutoReleaser( timeoutInSeconds, sequenceContextObj, processMsgs, waitRes)
Return Value
An object that automatically calls the Semaphore.ReleaseSemaphoreEx method on the semaphore when you release the last reference to the AutoReleaser object.
Purpose
Performs an Acquire (decrement) operation on the semaphore and returns an AutoReleaser object that automatically calls the Semaphore.ReleaseSemaphoreEx method when you release the last reference to the AutoReleaser object. This is useful for controlling the lifetime of the Acquire operation.
Parameters
timeoutInSeconds As Double
[In] Specifies a timeout in seconds. Pass a negative number to specify that you do not want a timeout.
sequenceContextObj As Object
[In] Specifies a sequence context when you call this method from within a step of an execution. You must use the sequence context of the sequence in which you are calling this method. Pass a NULL reference when you do not call this method from an execution. This method uses the sequence context to improve the behavior of the execution when it is blocked while waiting on this method.
processMsgs As Boolean
[In] Pass True to process Microsoft Windows messages while waiting. When you call this method from an execution, pass True for this parameter. Otherwise, pass False .
waitRes As WaitResult
[Out] Returns the status of the Acquire operation.