summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-02-02 03:00:34 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-02-02 03:00:34 +0000
commit537b78b216e2d7d7694cf887bda1ad5587c4d5d2 (patch)
tree626479d6b82499584a952985764b7ccab7258985 /firmware/thread.c
parentd08af61394bb9d6c3cbb614f790091de44cbfd1b (diff)
downloadrockbox-537b78b216e2d7d7694cf887bda1ad5587c4d5d2.tar.gz
rockbox-537b78b216e2d7d7694cf887bda1ad5587c4d5d2.zip
Fix a minor ;) problem that would keep other threads from running during priority_yield calls unless they had aged too much. Basically it operates in the manner of the original implementation. _May_ help 5.5g buffering problems so do test that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16197 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index ca6c64039e..fdef2cdf2b 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -1615,12 +1615,13 @@ void switch_thread(struct thread_entry *old)
1615 * got CPU time. */ 1615 * got CPU time. */
1616 for (;;) 1616 for (;;)
1617 { 1617 {
1618 int priority = MIN(thread->priority, thread->priority_x); 1618 int priority = thread->priority;
1619 1619
1620 if (priority < cores[core].highest_priority) 1620 if (priority < cores[core].highest_priority)
1621 cores[core].highest_priority = priority; 1621 cores[core].highest_priority = priority;
1622 1622
1623 if (priority == cores[core].highest_priority || 1623 if (priority == cores[core].highest_priority ||
1624 thread->priority_x < cores[core].highest_priority ||
1624 (current_tick - thread->last_run > priority * 8)) 1625 (current_tick - thread->last_run > priority * 8))
1625 { 1626 {
1626 cores[core].running = thread; 1627 cores[core].running = thread;
@@ -2402,7 +2403,6 @@ void priority_yield(void)
2402 thread->priority_x = HIGHEST_PRIORITY; 2403 thread->priority_x = HIGHEST_PRIORITY;
2403 switch_thread(NULL); 2404 switch_thread(NULL);
2404 thread->priority_x = LOWEST_PRIORITY; 2405 thread->priority_x = LOWEST_PRIORITY;
2405 cores[core].highest_priority = LOWEST_PRIORITY;
2406} 2406}
2407#endif /* HAVE_PRIORITY_SCHEDULING */ 2407#endif /* HAVE_PRIORITY_SCHEDULING */
2408 2408