summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-23 09:22:07 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-23 09:22:07 +0000
commit29f80283e958121dbf25ab9c279e2a95dbb36471 (patch)
treedb3b22fd8ebb609ea92987c01c5d641a814c1f99 /firmware
parent82e6a072986aceee573a57f30157556330d59d1e (diff)
Added queue_empty()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@658 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/kernel.c5
-rw-r--r--firmware/kernel.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c
index c6ac1fb7aa..639b73def5 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -94,6 +94,11 @@ void queue_post(struct event_queue *q, int id, void *data)
set_irq_level(oldlevel);
}
+bool queue_empty(struct event_queue* q)
+{
+ return ( q->read == q->write );
+}
+
/****************************************************************************
* Timer tick
diff --git a/firmware/kernel.h b/firmware/kernel.h
index cd5539b791..8f981b3753 100644
--- a/firmware/kernel.h
+++ b/firmware/kernel.h
@@ -19,6 +19,8 @@
#ifndef _KERNEL_H_
#define _KERNEL_H_
+#include <stdbool.h>
+
/* wrap-safe macros for tick comparison */
#define TIME_AFTER(a,b) ((long)(b) - (long)(a) < 0)
#define TIME_BEFORE(a,b) TIME_AFTER(b,a)
@@ -60,6 +62,7 @@ int tick_remove_task(void (*f)(void));
extern void queue_init(struct event_queue *q);
extern void queue_wait(struct event_queue *q, struct event *ev);
extern void queue_post(struct event_queue *q, int id, void *data);
+extern bool queue_empty(struct event_queue* q);
extern void mutex_init(struct mutex *m);
extern void mutex_lock(struct mutex *m);