queue: Add k_queue_remove
k_queue_remove can be used to remove an element from any position in the queue. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
cf9613deec
commit
50b9377b45
1 changed files with 19 additions and 0 deletions
|
@ -1465,6 +1465,25 @@ extern void k_queue_merge_slist(struct k_queue *queue, sys_slist_t *list);
|
|||
*/
|
||||
extern void *k_queue_get(struct k_queue *queue, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Remove an element from a queue.
|
||||
*
|
||||
* This routine removes data item from @a queue. The first 32 bits of the
|
||||
* data item are reserved for the kernel's use. Removing elements from k_queue
|
||||
* rely on sys_slist_find_and_remove which is not a constant time operation.
|
||||
*
|
||||
* @note Can be called by ISRs
|
||||
*
|
||||
* @param queue Address of the queue.
|
||||
* @param data Address of the data item.
|
||||
*
|
||||
* @return true if data item was removed
|
||||
*/
|
||||
static inline bool k_queue_remove(struct k_queue *queue, void *data)
|
||||
{
|
||||
return sys_slist_find_and_remove(&queue->data_q, (sys_snode_t *)data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Query a queue to see if it has data available.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue