MBX_post
2-200
C Interface
Syntax
status = MBX_post(mbx, msg, timeout);
Parameters
MBX_Handle mbx;
/* mailbox object handle */
Ptr
msg;
/* message pointer */
Uns
timeout; /* return after this many system clock ticks */
Return Value
Bool
status;
/* TRUE if successful, FALSE if timeout */
Description
MBX_post checks to see if there are any free message slots before
copying msg into the mailbox. MBX_post readies the first task (if any)
waiting on mbx.
If the mailbox is full and timeout is SYS_FOREVER, the task remains
suspended until MBX_pend is called on this mailbox. If timeout is 0,
MBX_post returns immediately. Otherwise, the task is suspended for
timeout system clock ticks. The actual time of task suspension can be up
to 1 system clock tick less than timeout due to granularity in system
timekeeping.
If timeout expires (or timeout is 0) before the mailbox is available,
MBX_post returns FALSE. Otherwise MBX_post returns TRUE.
A task switch occurs when calling MBX_post if a higher priority task is
made ready to run, or if there are no free message slots and timeout is
not 0.
Constraints and
Calling Context
❏
If you need to call MBX_post within a TSK_disable/TSK_enable
block, you must use a timeout of 0.
❏
This API can be called from a TSK with any timeout value, but if
called from an HWI or SWI the timeout must be 0.
❏
MBX_post can be called from the program’s main() function.
However, the number of calls should not be greater than the number
of messages the mailbox can hold. Additional calls have no effect.
See Also
MBX_post
Post a message to mailbox