Docs » Autodocs » exec.library » ReleaseSemaphore
ReleaseSemaphore -- make signal semaphore available to others
ReleaseSemaphore(signalSemaphore) A0 void ReleaseSemaphore(struct SignalSemaphore *);
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.
signalSemaphore -- an initialized signal semaphore structure
In V39 and V40 Kickstart, there is an error condition that bumps ss_NestCount twice, if multiple Procure() SemaphoreMessages and a ObtainSemaphore() are pending for the same task.
This call is guaranteed to preserve all registers.
InitSemaphore(), ObtainSemaphore(), ObtainSemaphoreShared()
|