Simplification, queue pointers don't wrap (except at INT_MAX, but the calculation is still correct in this case). Implemented queue_count() for the simulator.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13154 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9bfa237869
commit
0b7bb31453
3 changed files with 10 additions and 12 deletions
|
@ -943,9 +943,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists,
|
|||
case ACTION_STD_PREV:
|
||||
case ACTION_STD_PREVREPEAT:
|
||||
gui_synclist_select_previous(lists);
|
||||
#ifndef SIMULATOR
|
||||
if (queue_count(&button_queue) < FRAMEDROP_TRIGGER)
|
||||
#endif
|
||||
gui_synclist_draw(lists);
|
||||
yield();
|
||||
return ACTION_STD_PREV;
|
||||
|
@ -953,9 +951,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists,
|
|||
case ACTION_STD_NEXT:
|
||||
case ACTION_STD_NEXTREPEAT:
|
||||
gui_synclist_select_next(lists);
|
||||
#ifndef SIMULATOR
|
||||
if (queue_count(&button_queue) < FRAMEDROP_TRIGGER)
|
||||
#endif
|
||||
gui_synclist_draw(lists);
|
||||
yield();
|
||||
return ACTION_STD_NEXT;
|
||||
|
|
|
@ -345,7 +345,7 @@ intptr_t queue_send(struct event_queue *q, long id, intptr_t data)
|
|||
{
|
||||
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
|
||||
unsigned int wr;
|
||||
|
||||
|
||||
lock_cores();
|
||||
|
||||
wr = q->write++ & QUEUE_LENGTH_MASK;
|
||||
|
@ -495,23 +495,20 @@ void queue_remove_from_head(struct event_queue *q, long id)
|
|||
int queue_count(const struct event_queue *q)
|
||||
{
|
||||
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
|
||||
int result = 0;
|
||||
int result;
|
||||
|
||||
#if NUM_CORES > 1
|
||||
if (!q->irq_safe)
|
||||
lock_cores();
|
||||
#endif
|
||||
|
||||
if (q->read <= q->write)
|
||||
result = q->write - q->read;
|
||||
else
|
||||
result = QUEUE_LENGTH - (q->read - q->write);
|
||||
|
||||
result = q->write - q->read;
|
||||
|
||||
#if NUM_CORES > 1
|
||||
if (!q->irq_safe)
|
||||
unlock_cores();
|
||||
#endif
|
||||
|
||||
|
||||
set_irq_level(oldlevel);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -281,6 +281,11 @@ void queue_remove_from_head(struct event_queue *q, long id)
|
|||
set_irq_level(oldlevel);
|
||||
}
|
||||
|
||||
int queue_count(const struct event_queue *q)
|
||||
{
|
||||
return q->write - q->read;
|
||||
}
|
||||
|
||||
void switch_thread(bool save_context, struct thread_entry **blocked_list)
|
||||
{
|
||||
(void)save_context;
|
||||
|
|
Loading…
Reference in a new issue