This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

priority in mailbox

Hello All,

I have application having multiple mailbox writers and a single mailbox reader.  Is there a way of  assigning priority to the messages, so that messages from some writers are handled first, even though you have messages in the mailbox from other writers to be handled and processed.

Thanks

Narendra

  • Narendra,

    The mailbox object does not support message priority. However, you can work up a system which accomplishes the same goal. Create a separate mailbox instance for each writer. This allows you to implicitly assign a priority to each mailbox. The trick is to have one reader respond to all the mailboxes. You can do this by using an event instance.

    Create an event instance. Use that event instance when creating each mailbox instance. Assign the event instance to the readerEvent property of the mailbox create params structure. Use the same event instance for all mailboxes, but assign each one a unique eventId.

    At run-time, have the reader task wait on the event instance (Event_pend) instead of the mailbox. When the reader task returns, you will have one or more mailboxes which have a message to be read. Use the event mask to check which mailbox has a message. The order in which you check the mask determines the priority. Once you figure out which mailbox has a message, you must still call Mailbox_pend to retrieve the message.

    Look in the SYS/BIOS User Guide (4.4 Mailboxes) for a description.

    ~Ramsey