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.

problem with using Mailbox_getNumPendingMsgs

Other Parts Discussed in Thread: SYSBIOS

HI

i'm trying to use this API after creating Mail box and pending on this API return 0 all of the time , is there is any configuration to use this plz advice

thanks

marwa

  • Marwa,

    I looked into this and it appears that when there is no task blocked in Mailbox_pend(), Mailbox_getNumPendingMsgs() should return an accurate number. However, I think that a corner case exists that if a low priority Task is blocked in Mailbox_pend() when the FIRST message is posted by a higher priority thread using Mailbox_post(), then until that lower priority task is allowed to run, Mailbox_getNumPendingMsgs() will return 0, even though there is one yet unclaimed message in the Mailbox.

    Alan
  • I have a possible fix for this that I am testing locally. You can try it also.

    In your BIOS installation, make a backup copy of this file:

       packages/ti/sysbios/knl/Mailbox.c

    Then find this line in the Mailbox.c file:

         return (Semaphore_getCount(dataSem));

    and change it to this:

         return (obj->numMsgs - obj->numFreeMsgs);

    Then, add this to your .cfg file settings if you are not already using the custom library build option:

         var BIOS = xdc.useModule('ti.sysbios.BIOS');

         BIOS.libType = BIOS.LibType_Custom;

    This will cause a new SYS/BIOS library to built with the changes you made to the Mailbox.c file.

    Let me know if this corrects the behavior you're seeing.

    Alan