summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-08-12 11:59:06 +0000
committerJens Arnold <amiconn@rockbox.org>2007-08-12 11:59:06 +0000
commitea8857149316902f592145ceee7f61cdaa0eccf8 (patch)
tree09a9e08a852d964d35053063627a198d11cace1d /uisimulator
parent671f5d4412333f4ee101a5eb9a984dd21b5028e0 (diff)
Fix red simulator builds. queue_broadcast() was missing...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14293 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/sdl/kernel.c55
1 files changed, 52 insertions, 3 deletions
diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c
index b2bf77026f..2b194a24ae 100644
--- a/uisimulator/sdl/kernel.c
+++ b/uisimulator/sdl/kernel.c
@@ -27,6 +27,10 @@
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
+/* This array holds all queues that are initiated. It is used for broadcast. */
+static struct event_queue *all_queues[32];
+static int num_queues = 0;
+
int set_irq_level (int level)
{
static int _lv = 0;
@@ -91,19 +95,52 @@ void queue_enable_queue_send(struct event_queue *q,
void queue_init(struct event_queue *q, bool register_queue)
{
- (void)register_queue;
-
q->read = 0;
q->write = 0;
q->thread = NULL;
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
q->send = NULL; /* No message sending by default */
#endif
+
+ if(register_queue)
+ {
+ /* Add it to the all_queues array */
+ all_queues[num_queues++] = q;
+ }
}
void queue_delete(struct event_queue *q)
{
- (void)q;
+ int i;
+ bool found = false;
+
+#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
+ /* Release waiting threads and reply to any dequeued message
+ waiting for one. */
+ queue_release_all_senders(q);
+ queue_reply(q, 0);
+#endif
+
+ /* Find the queue to be deleted */
+ for(i = 0;i < num_queues;i++)
+ {
+ if(all_queues[i] == q)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(found)
+ {
+ /* Move the following queues up in the list */
+ for(;i < num_queues-1;i++)
+ {
+ all_queues[i] = all_queues[i+1];
+ }
+
+ num_queues--;
+ }
}
void queue_wait(struct event_queue *q, struct event *ev)
@@ -286,6 +323,18 @@ int queue_count(const struct event_queue *q)
return q->write - q->read;
}
+int queue_broadcast(long id, intptr_t data)
+{
+ int i;
+
+ for(i = 0;i < num_queues;i++)
+ {
+ queue_post(all_queues[i], id, data);
+ }
+
+ return num_queues;
+}
+
void switch_thread(bool save_context, struct thread_entry **blocked_list)
{
(void)save_context;