NetBurner 3.5.0
PDF Version |
|
Mailboxes single value storage locations used to communicate between tasks. More...
#include <nbrtos.h>
Inherits OS_TASK_DLY_OBJ.
Public Member Functions | |
OS_MBOX () | |
Create and initialize a mailbox object with no defalut message. | |
OS_MBOX (void *msg) | |
Create and initialize a mailbox object with the specified message. | |
uint8_t | Init (void *msg=NULL) |
Sets the mailbox object to its initial state. | |
uint8_t | Post (void *msg) |
Post a message to the mailbox. | |
void * | Pend (uint32_t timeoutTicks, uint8_t &result) |
Wait the specified number of time ticks for some other task to post to the mailbox. | |
void * | Pend (TickTimeout &t, uint8_t &result) |
Wait the specified number of TickTimeout ticks for some other task to post to the mailbox. | |
void * | Pend (uint32_t timeoutTicks=WAIT_FOREVER) |
Wait the specified number of time ticks for some other task to post to the mailbox. | |
void * | PendUntil (uint32_t timeoutTime, uint8_t &result) |
Wait the specified number of TimeTicks for some other task to post to the mailbox. | |
void * | PendNoWait (uint8_t &result) |
Checks if a message is available in the mailbox and returns immediately. | |
void * | PendNoWait () |
Checks if a message is available in the mailbox and returns immediately. | |
Mailboxes single value storage locations used to communicate between tasks.
A mailbox is a storage location large enough to hold a single void pointer value, access to which is controlled so that it may be safely utilized by multiple tasks. If a task writes to a mailbox, it is then full and no task can send/post to it until a task does a read/pend on the mailbox or the mailbox is reset.
The void pointer can represent anything, such as a pointer to a variable, object, string, or just used as a 32-bit value. How it is used is defined by the tasks that post and pend to it.
|
inline |
Create and initialize a mailbox object with no defalut message.
|
inline |
Create and initialize a mailbox object with the specified message.
msg | Message that the mailbox should be initialized with |
uint8_t OS_MBOX::Init | ( | void * | msg = NULL | ) |
Sets the mailbox object to its initial state.
If called without a msg parameter, it will default to a value of null.
msg | Message that the mailbox should be initialized with |
void * OS_MBOX::Pend | ( | TickTimeout & | t, |
uint8_t & | result ) |
Wait the specified number of TickTimeout ticks for some other task to post to the mailbox.
t | The number of TicksTimeout ticks to wait. 0 will wait forever. |
result | Reference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out. |
Message | If successful |
NULL | If it timed out |
|
inline |
Wait the specified number of time ticks for some other task to post to the mailbox.
timeoutTicks | The number of system ticks to wait. 0 will wait forever. |
result | Reference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out. |
Message | If successful |
NULL | If it timed out |
|
inline |
Wait the specified number of time ticks for some other task to post to the mailbox.
timeoutTicks | The number of system ticks to wait. If no value is specified, it will wait forever. |
Message | If successful |
NULL | If it timed out |
|
inline |
Checks if a message is available in the mailbox and returns immediately.
Message | If successful |
NULL | If it timed out |
void * OS_MBOX::PendNoWait | ( | uint8_t & | result | ) |
Checks if a message is available in the mailbox and returns immediately.
result | Reference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out. |
Message | If successful |
NULL | If it timed out |
|
inline |
Wait the specified number of TimeTicks for some other task to post to the mailbox.
timeoutTime | The value of system time ticks to wait |
result | Reference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out. |
Message | If successful |
NULL | If it timed out |
uint8_t OS_MBOX::Post | ( | void * | msg | ) |
Post a message to the mailbox.
msg | Message that the mailbox should post |
OS_NO_ERR | If successful |
OS_MBOX_FULL | If the mailbox is full |