User`s guide
Mailboxes
Thread Scheduling 4-61
4.7 Mailboxes
The MBX module provides a set of functions to manage mailboxes. MBX
mailboxes can be used to pass messages from one task to another on the
same processor. An intertask synchronization enforced by a fixed length
shared mailbox can be used to ensure that the flow of incoming messages
does not exceed the ability of the system to process those messages. The
examples given in this section illustrate just such a scheme.
The mailboxes managed by the MBX module are separate from the mailbox
structure contained within a SWI object.
MBX_create and MBX_delete are used to create and delete mailboxes,
respectively. You can also use the Configuration Tool to create mailbox
objects. See section 2.2.8, Creating, Referencing, and Deleting Dynamically-
Created DSP/BIOS Objects, page 2-10, for a discussion of the benefits of
creating objects with the Configuration Tool.
You specify the mailbox length and message size when you create a mailbox
as shown in Example 4-13.
Example 4-13. Creating a Mailbox
MBX_pend is used to read a message from a mailbox as shown in Example
4-14. If no message is available (that is, the mailbox is empty), MBX_pend
blocks. In this case, the timeout parameter allows the task to wait until a
timeout, to wait indefinitely, or to not wait at all.
Example 4-14. Reading a Message from a Mailbox
MBX_Handle MBX_create(msgsize, mbxlength, attrs)
Uns msgsize;
Uns mbxlength;
MBX_Attrs *attrs;
Void MBX_delete(mbx)
MBX_Handle mbx;
Bool MBX_pend(mbx, msg, timeout)
MBX_Handle mbx;
Void *msg;
Uns timeout; /* return after this many */
/* system clock ticks */










