Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Latest commit

 

History

History
42 lines (28 loc) · 1.19 KB

ReleaseSemaphore.md

File metadata and controls

42 lines (28 loc) · 1.19 KB

NAME

ReleaseSemaphore -- make signal semaphore available to others

SYNOPSIS

    ReleaseSemaphore(signalSemaphore)
                     A0

    void ReleaseSemaphore(struct SignalSemaphore *);

Links: SignalSemaphore

FUNCTION

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.

Needless to say, havoc breaks out if the task releases more times than it has obtained.

INPUT signalSemaphore -- an initialized signal semaphore structure

NOTE This call is guaranteed to preserve all registers.

SEE ALSO

InitSemaphore, ObtainSemaphore, ObtainSemaphoreShared