Skip to content

Commit

Permalink
Merge pull request #11145 from Tharazi97/CountFunctionQueue
Browse files Browse the repository at this point in the history
Implement queue.count()
  • Loading branch information
Seppo Takalo authored Aug 6, 2019
2 parents dd2d585 + 32bdde5 commit 34813ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rtos/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
return osMessageQueueGetSpace(_id) == 0;
}

/** Get number of queued messages in the queue.
*
* @return Number of items in the queue
*
* @note You may call this function from ISR context.
*/
uint32_t count() const
{
return osMessageQueueGetCount(_id);
}

/** Inserts the given element to the end of the queue.
*
* This function puts the message pointed to by `data` into the queue. The
Expand Down

0 comments on commit 34813ed

Please sign in to comment.