diff options
-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); | |||
360 | higher priority than current were woken) */ | 360 | higher priority than current were woken) */ |
361 | 361 | ||
362 | /* A convenience function for waking an entire queue of threads. */ | 362 | /* A convenience function for waking an entire queue of threads. */ |
363 | unsigned int thread_queue_wake(struct thread_entry **list, | 363 | unsigned int thread_queue_wake(struct thread_entry **list); |
364 | volatile int *count); | ||
365 | 364 | ||
366 | /* Wakeup a thread at the head of a list */ | 365 | /* Wakeup a thread at the head of a list */ |
367 | enum wakeup_thread_protocol | 366 | 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 | |||
124 | mrsw_writer_wakeup_readers(struct mrsw_lock *mrsw) | 124 | mrsw_writer_wakeup_readers(struct mrsw_lock *mrsw) |
125 | { | 125 | { |
126 | mrsw->splay.blocker.thread = NULL; | 126 | mrsw->splay.blocker.thread = NULL; |
127 | for (int count = 0; mrsw->queue && mrsw->queue->retval != 0; count++) | 127 | int count = 0; |
128 | |||
129 | while (mrsw->queue && mrsw->queue->retval != 0) | ||
130 | { | ||
128 | wakeup_thread(&mrsw->queue); | 131 | wakeup_thread(&mrsw->queue); |
132 | count++; | ||
133 | } | ||
134 | |||
135 | mrsw->count = count; | ||
129 | return THREAD_OK; | 136 | return THREAD_OK; |
130 | } | 137 | } |
131 | 138 | ||
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) | |||
267 | corelock_unlock(&all_queues.cl); | 267 | corelock_unlock(&all_queues.cl); |
268 | 268 | ||
269 | /* Release thread(s) waiting on queue head */ | 269 | /* Release thread(s) waiting on queue head */ |
270 | thread_queue_wake(&q->queue, NULL); | 270 | thread_queue_wake(&q->queue); |
271 | 271 | ||
272 | #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME | 272 | #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME |
273 | if(q->send) | 273 | 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) | |||
1527 | * INTERNAL: Intended for use by kernel objects and not for programs. | 1527 | * INTERNAL: Intended for use by kernel objects and not for programs. |
1528 | *--------------------------------------------------------------------------- | 1528 | *--------------------------------------------------------------------------- |
1529 | */ | 1529 | */ |
1530 | unsigned int thread_queue_wake(struct thread_entry **list, | 1530 | unsigned int thread_queue_wake(struct thread_entry **list) |
1531 | volatile int *count) | ||
1532 | { | 1531 | { |
1533 | int num = 0; | ||
1534 | unsigned result = THREAD_NONE; | 1532 | unsigned result = THREAD_NONE; |
1535 | 1533 | ||
1536 | for (;;) | 1534 | for (;;) |
@@ -1541,12 +1539,8 @@ unsigned int thread_queue_wake(struct thread_entry **list, | |||
1541 | break; /* No more threads */ | 1539 | break; /* No more threads */ |
1542 | 1540 | ||
1543 | result |= rc; | 1541 | result |= rc; |
1544 | num++; | ||
1545 | } | 1542 | } |
1546 | 1543 | ||
1547 | if (count) | ||
1548 | *count = num; | ||
1549 | |||
1550 | return result; | 1544 | return result; |
1551 | } | 1545 | } |
1552 | 1546 | ||
@@ -1821,7 +1815,7 @@ static inline void thread_final_exit(struct thread_entry *current) | |||
1821 | * execution except the slot itself. */ | 1815 | * execution except the slot itself. */ |
1822 | 1816 | ||
1823 | /* Signal this thread */ | 1817 | /* Signal this thread */ |
1824 | thread_queue_wake(¤t->queue, NULL); | 1818 | thread_queue_wake(¤t->queue); |
1825 | corelock_unlock(¤t->waiter_cl); | 1819 | corelock_unlock(¤t->waiter_cl); |
1826 | switch_thread(); | 1820 | switch_thread(); |
1827 | /* This should never and must never be reached - if it is, the | 1821 | /* 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) | |||
439 | return THREAD_NONE; | 439 | return THREAD_NONE; |
440 | } | 440 | } |
441 | 441 | ||
442 | unsigned int thread_queue_wake(struct thread_entry **list, | 442 | unsigned int thread_queue_wake(struct thread_entry **list) |
443 | volatile int *count) | ||
444 | { | 443 | { |
445 | unsigned int result = THREAD_NONE; | 444 | unsigned int result = THREAD_NONE; |
446 | int num = 0; | ||
447 | 445 | ||
448 | for (;;) | 446 | for (;;) |
449 | { | 447 | { |
@@ -453,12 +451,8 @@ unsigned int thread_queue_wake(struct thread_entry **list, | |||
453 | break; | 451 | break; |
454 | 452 | ||
455 | result |= rc; | 453 | result |= rc; |
456 | num++; | ||
457 | } | 454 | } |
458 | 455 | ||
459 | if (count) | ||
460 | *count = num; | ||
461 | |||
462 | return result; | 456 | return result; |
463 | } | 457 | } |
464 | 458 | ||
@@ -621,7 +615,7 @@ void remove_thread(unsigned int thread_id) | |||
621 | 615 | ||
622 | new_thread_id(thread->id, thread); | 616 | new_thread_id(thread->id, thread); |
623 | thread->state = STATE_KILLED; | 617 | thread->state = STATE_KILLED; |
624 | thread_queue_wake(&thread->queue, NULL); | 618 | thread_queue_wake(&thread->queue); |
625 | 619 | ||
626 | SDL_DestroySemaphore(s); | 620 | SDL_DestroySemaphore(s); |
627 | 621 | ||