diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2014-08-06 02:10:14 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2014-08-06 02:27:49 -0400 |
commit | 81ffd9bfeee6aca65f507a46c8123b47ca6e2803 (patch) | |
tree | e9eb535dbc71f35bce7519d7a6a063e4a683ba55 /firmware | |
parent | e7e302f2559ec2c8878e5b5205755900215196b3 (diff) |
Fix some stuff for no priority and
thread_queue_wake() doesn't need the 2nd parameter. The original purpose
for it never came to be.
Non priority version mrsw_writer_wakeup_readers was left improperly
finished. Get that back into line.
Change-Id: Ic613a2479f3cc14dc7c761517670eb15178da9f5
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/kernel/include/thread.h | 3 | ||||
-rw-r--r-- | firmware/kernel/mrsw_lock.c | 9 | ||||
-rw-r--r-- | firmware/kernel/queue.c | 2 | ||||
-rw-r--r-- | firmware/kernel/thread.c | 10 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/thread-sdl.c | 10 |
5 files changed, 14 insertions, 20 deletions
diff --git a/firmware/kernel/include/thread.h b/firmware/kernel/include/thread.h index f181f867cb..e10b4e21b4 100644 --- a/firmware/kernel/include/thread.h +++ b/firmware/kernel/include/thread.h @@ -360,8 +360,7 @@ void block_thread(struct thread_entry *current, int timeout); higher priority than current were woken) */ /* A convenience function for waking an entire queue of threads. */ -unsigned int thread_queue_wake(struct thread_entry **list, - volatile int *count); +unsigned int thread_queue_wake(struct thread_entry **list); /* Wakeup a thread at the head of a list */ enum wakeup_thread_protocol diff --git a/firmware/kernel/mrsw_lock.c b/firmware/kernel/mrsw_lock.c index 42f43caec3..46ab893622 100644 --- a/firmware/kernel/mrsw_lock.c +++ b/firmware/kernel/mrsw_lock.c @@ -124,8 +124,15 @@ static FORCE_INLINE unsigned int mrsw_writer_wakeup_readers(struct mrsw_lock *mrsw) { mrsw->splay.blocker.thread = NULL; - for (int count = 0; mrsw->queue && mrsw->queue->retval != 0; count++) + int count = 0; + + while (mrsw->queue && mrsw->queue->retval != 0) + { wakeup_thread(&mrsw->queue); + count++; + } + + mrsw->count = count; return THREAD_OK; } diff --git a/firmware/kernel/queue.c b/firmware/kernel/queue.c index 22a8da9bd3..c8beb908b6 100644 --- a/firmware/kernel/queue.c +++ b/firmware/kernel/queue.c @@ -267,7 +267,7 @@ void queue_delete(struct event_queue *q) corelock_unlock(&all_queues.cl); /* Release thread(s) waiting on queue head */ - thread_queue_wake(&q->queue, NULL); + thread_queue_wake(&q->queue); #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME if(q->send) diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c index 0a47f97e93..9855cc3c84 100644 --- a/firmware/kernel/thread.c +++ b/firmware/kernel/thread.c @@ -1527,10 +1527,8 @@ void block_thread(struct thread_entry *current, int timeout) * INTERNAL: Intended for use by kernel objects and not for programs. *--------------------------------------------------------------------------- */ -unsigned int thread_queue_wake(struct thread_entry **list, - volatile int *count) +unsigned int thread_queue_wake(struct thread_entry **list) { - int num = 0; unsigned result = THREAD_NONE; for (;;) @@ -1541,12 +1539,8 @@ unsigned int thread_queue_wake(struct thread_entry **list, break; /* No more threads */ result |= rc; - num++; } - if (count) - *count = num; - return result; } @@ -1821,7 +1815,7 @@ static inline void thread_final_exit(struct thread_entry *current) * execution except the slot itself. */ /* Signal this thread */ - thread_queue_wake(¤t->queue, NULL); + thread_queue_wake(¤t->queue); corelock_unlock(¤t->waiter_cl); switch_thread(); /* This should never and must never be reached - if it is, the diff --git a/firmware/target/hosted/sdl/thread-sdl.c b/firmware/target/hosted/sdl/thread-sdl.c index eaf59e245d..e117a4e3b6 100644 --- a/firmware/target/hosted/sdl/thread-sdl.c +++ b/firmware/target/hosted/sdl/thread-sdl.c @@ -439,11 +439,9 @@ unsigned int wakeup_thread_(struct thread_entry **list) return THREAD_NONE; } -unsigned int thread_queue_wake(struct thread_entry **list, - volatile int *count) +unsigned int thread_queue_wake(struct thread_entry **list) { unsigned int result = THREAD_NONE; - int num = 0; for (;;) { @@ -453,12 +451,8 @@ unsigned int thread_queue_wake(struct thread_entry **list, break; result |= rc; - num++; } - if (count) - *count = num; - return result; } @@ -621,7 +615,7 @@ void remove_thread(unsigned int thread_id) new_thread_id(thread->id, thread); thread->state = STATE_KILLED; - thread_queue_wake(&thread->queue, NULL); + thread_queue_wake(&thread->queue); SDL_DestroySemaphore(s); |