forked from len0rd/rockbox
kernel: Add queue_full() API call
This allows callers to see if it's safe to enqueue something instead of triggering a panic if the queue turns out to be full. Change-Id: Idb887e7a47cfbfef998f27d9d85090f3c0ed2230
This commit is contained in:
parent
2f3b9ab68a
commit
d13029ebdd
2 changed files with 7 additions and 0 deletions
|
@ -701,6 +701,12 @@ bool queue_empty(const struct event_queue* q)
|
|||
return ( q->read == q->write );
|
||||
}
|
||||
|
||||
/* Poll queue to see if it is full */
|
||||
bool queue_full(const struct event_queue* q)
|
||||
{
|
||||
return ((q->write - q->read) >= QUEUE_LENGTH);
|
||||
}
|
||||
|
||||
void queue_clear(struct event_queue* q)
|
||||
{
|
||||
int oldlevel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue