Asynchron locking of a semaphore
Source position: exec.pas line 2043
function Procure( |
sigSem: PSignalSemaphore; |
bidMsg: PSemaphoreMessage |
):Cardinal; |
sigSem |
|
The SignalSemaphore that you wish to lock |
bidMsg |
|
The SemaphoreMessage that you wish replied when you obtain access to the semaphore. The message's ssm_Semaphore field will point at the semaphore that was obtained. If the ssm_Semaphore field is nil, the Procure() was aborted via Vacate(). The mn_ReplyPort field of the message must point to a valid message port. To obtain a shared semaphore, the ln_Name field must be set to 1. For an exclusive lock, the ln_Name field must be 0. No other values are valid. |
This function is used to obtain a semaphore in an async manner. Like ObtainSemaphore(), it will obtain a SignalSemaphore for you but unlike ObtainSemaphore(), you will not block until you get the semaphore. Procure() will just post a request for the semaphore and will return. When the semaphore is available (which could be at any time) the bidMessage will ReplyMsg() and you will own the semaphore. This lets you wait on multiple semaphores at once and to continue processing while waiting for the semaphore.
|
Get a List of semaphores |
|
|
Initialize a signal semaphore |
|
|
Make signal semaphore available to others |
|
|
Try to obtain a Semaphore without blocking |
|
|
Gain exclusive access to a semaphore |
|
|
Gain access to a semaphore in shared mode |
|
|
Release a bidMessage from Procure() |