Added empty, full function to Queue and Mail

pull/5158/head
YarivCol 2017-09-21 03:09:45 -07:00
parent 003dd7c47f
commit cf2378ecbd
2 changed files with 32 additions and 0 deletions

View File

@ -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.

View File

@ -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)