mirror of https://github.com/ARMmbed/mbed-os.git
Added empty, full function to Queue and Mail
parent
003dd7c47f
commit
cf2378ecbd
16
rtos/Mail.h
16
rtos/Mail.h
|
@ -54,6 +54,22 @@ public:
|
|||
/** Create and Initialise Mail queue. */
|
||||
Mail() { };
|
||||
|
||||
/** Check if the mail queue is empty
|
||||
*
|
||||
* @return True if the mail queue is mail, false if not
|
||||
*/
|
||||
bool empty() const {
|
||||
return _queue.empty();
|
||||
}
|
||||
|
||||
/** Check if the mail queue is full
|
||||
*
|
||||
* @return True if the mail queue is full, false if not
|
||||
*/
|
||||
bool full() const {
|
||||
return _queue.full();
|
||||
}
|
||||
|
||||
/** Allocate a memory block of type T
|
||||
@param millisec timeout value or 0 in case of no time-out. (default: 0).
|
||||
@return pointer to memory block that can be filled with mail or NULL in case error.
|
||||
|
|
16
rtos/Queue.h
16
rtos/Queue.h
|
@ -64,6 +64,22 @@ public:
|
|||
osMessageQueueDelete(_id);
|
||||
}
|
||||
|
||||
/** Check if the queue is empty
|
||||
*
|
||||
* @return True if the queue is empty, false if not
|
||||
*/
|
||||
bool empty() const {
|
||||
return osMessageQueueGetCount(_id) == 0;
|
||||
}
|
||||
|
||||
/** Check if the queue is full
|
||||
*
|
||||
* @return True if the queue is full, false if not
|
||||
*/
|
||||
bool full() const {
|
||||
return osMessageQueueGetSpace(_id) == 0;
|
||||
}
|
||||
|
||||
/** Put a message in a Queue.
|
||||
@param data message pointer.
|
||||
@param millisec timeout value or 0 in case of no time-out. (default: 0)
|
||||
|
|
Loading…
Reference in New Issue