Page 1 of 1

MailBox: Different between chMBPostAheadS and chMBPostAheadI

Posted: Wed Dec 05, 2012 5:05 am
by oattao
Hi all. I have a problem with MailBox. I don't know what is the different between two functions of MaiBox:

Code: Select all

chMBPostAheadS (Mailbox *mbp, msg_t msg, systime_t time)
    //Posts an high priority message into a mailbox.

Code: Select all

chMBPostAheadI (Mailbox *mbp, msg_t msg)
    //Posts an high priority message into a mailbox.


Please help me. Thanks in advance.

Re: MailBox: Different between chMBPostAheadS and chMBPostAh

Posted: Wed Dec 05, 2012 6:40 am
by Giovanni
Hi,

Read the "Kernel Concepts" in the kernel manual, the difference is all in the final letter:

I) Is meant to be used from ISRs. within a lock, and does not reschedule internally.
S) Is meant to be used from a thread. within a lock, and reschedules internally.

Note that the "I" version does not wait if the mailbox is full, it is not possible to wait from within an ISR.

Giovanni