Unit 'exec' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

Procure

Asynchron locking of a semaphore

Declaration

Source position: exec.pas line 2043

function Procure(

  sigSem: PSignalSemaphore;

  bidMsg: PSemaphoreMessage

):Cardinal;

Arguments

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.

Description

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.

See also

ObtainSemaphoreList

  

Get a List of semaphores

InitSemaphore

  

Initialize a signal semaphore

ReleaseSemaphore

  

Make signal semaphore available to others

AttemptSemaphore

  

Try to obtain a Semaphore without blocking

ObtainSemaphore

  

Gain exclusive access to a semaphore

ObtainSemaphoreShared

  

Gain access to a semaphore in shared mode

Vacate

  

Release a bidMessage from Procure()


Documentation generated on: 2021-07-30