SEM_postBinary
2-380
C Interface
Syntax
SEM_postBinary(sem);
Parameters
SEM_Handle sem;
/* semaphore object handle */
Return Value
Void
Description
SEM_pendBinary and SEM_postBinary are for use with binary
semaphores. These are semaphores that can have only two states:
available and unavailable. They can be used to share a single resource
between tasks. They can also be used for a basic signaling mechanism,
where the semaphore can be posted multiple times and a subsequent
call to SEM_pendBinary clears the count and returns. Binary
semaphores do not keep track of the count; they simply track whether the
semaphore has been posted or not.
In contrast, SEM_pend and SEM_post are for use with counting
semaphores, which keep track of the number of times the semaphore has
been posted. This is useful, for example, if you have a group of resources
that are shared between tasks. The APIs for binary and counting
semaphores cannot be mixed for a single semaphore.
SEM_postBinary readies the first task in the list if one or more tasks are
waiting. SEM_postBinary sets the semaphore count to non-zero
(available) if no tasks are waiting.
A task switch occurs when calling SEM_postBinary if a higher priority
task is made ready to run.
Constraints and
Calling Context
❏
When called within an HWI, the code sequence calling this API must
be either wrapped within an HWI_enter/HWI_exit pair or invoked by
the HWI dispatcher.
❏
If this API is called from within a TSK_disable/TSK_enable block, the
semaphore operation is not processed until TSK_enable is called.
See Also
SEM_postBinary
Signal a binary semaphore