kernel: Add k_msgq_peek() API
Add an API to peek into a message queue and read the first message without removing the message from the queue. Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
This commit is contained in:
parent
10b1ee149f
commit
3efd8e17bd
1 changed files with 17 additions and 0 deletions
|
@ -3327,6 +3327,23 @@ __syscall int k_msgq_put(struct k_msgq *q, void *data, s32_t timeout);
|
|||
*/
|
||||
__syscall int k_msgq_get(struct k_msgq *q, void *data, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Peek/read a message from a message queue.
|
||||
*
|
||||
* This routine reads a message from message queue @a q in a "first in,
|
||||
* first out" manner and leaves the message in the queue.
|
||||
*
|
||||
* @note Can be called by ISRs.
|
||||
*
|
||||
* @param q Address of the message queue.
|
||||
* @param data Address of area to hold the message read from the queue.
|
||||
*
|
||||
* @retval 0 Message read.
|
||||
* @retval -ENOMSG Returned when the queue has no message.
|
||||
* @req K-MSGQ-002
|
||||
*/
|
||||
__syscall int k_msgq_peek(struct k_msgq *q, void *data);
|
||||
|
||||
/**
|
||||
* @brief Purge a message queue.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue