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

ReleaseSemaphore

Make signal semaphore available to others

Declaration

Source position: exec.pas line 1823

procedure ReleaseSemaphore(

  SigSem: PSignalSemaphore

);

Arguments

SigSem

  

An initialized signal semaphore structure which was obtained before

Description

ReleaseSemaphore() is the inverse of ObtainSemaphore(). It makes the semaphore lockable to other users. If tasks are waiting for the semaphore and this this task is done with the semaphore then the next waiting task is signalled.

Each ObtainSemaphore() call must be balanced by exactly one ReleaseSemaphore() call. This is because there is a nesting count maintained in the semaphore of the number of times that the current task has locked the semaphore. The semaphore is not released to other tasks until the number of releases matches the number of obtains.

Signal semaphores locked via ObtainSemaphoreShared are also released with this function.

Semaphores must released the same amount as is obtained.

See also

InitSemaphore

  

Initialize a signal semaphore

ObtainSemaphore

  

Gain exclusive access to a semaphore

ObtainSemaphoreShared

  

Gain access to a semaphore in shared mode


Documentation generated on: 2021-07-30