New kernel function, queue_delete(struct event_queue *q)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8424 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2006-01-23 10:53:47 +00:00
parent 6be916b379
commit 765e0f89d8
5 changed files with 36 additions and 0 deletions

View file

@ -86,6 +86,7 @@ int tick_add_task(void (*f)(void));
int tick_remove_task(void (*f)(void));
extern void queue_init(struct event_queue *q);
extern void queue_delete(struct event_queue *q);
extern void queue_wait(struct event_queue *q, struct event *ev);
extern void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks);
extern void queue_post(struct event_queue *q, long id, void *data);

View file

@ -83,6 +83,26 @@ void queue_init(struct event_queue *q)
all_queues[num_queues++] = q;
}
void queue_delete(struct event_queue *q)
{
int i;
/* Find the queue to be deleted */
for(i = 0;i < num_queues;i++)
{
if(all_queues[i] == q)
break;
}
/* 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)
{
while(q->read == q->write)

View file

@ -36,6 +36,11 @@ void queue_init(struct event_queue *q)
q->write = 0;
}
void queue_delete(struct event_queue *q)
{
(void)q;
}
void queue_wait(struct event_queue *q, struct event *ev)
{
while(q->read == q->write)

View file

@ -43,6 +43,11 @@ void queue_init(struct event_queue *q)
q->write = 0;
}
void queue_delete(struct event_queue *q)
{
(void)q;
}
void queue_wait(struct event_queue *q, struct event *ev)
{
while(q->read == q->write)

View file

@ -36,6 +36,11 @@ void queue_init(struct event_queue *q)
q->write = 0;
}
void queue_delete(struct event_queue *q)
{
(void)q;
}
void queue_wait(struct event_queue *q, struct event *ev)
{
while(q->read == q->write)