summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-05-01 15:36:12 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-05-01 15:36:12 +0000
commit72e08fb838f4277e86b10067b5215551b5bb5c8d (patch)
tree8ef84ab998c89652aedbdf65697ca6c6da8e01ad
parent1bad055d2a1d760738ed0cbc5bfad0eb6b876955 (diff)
downloadrockbox-72e08fb838f4277e86b10067b5215551b5bb5c8d.zip
rockbox-72e08fb838f4277e86b10067b5215551b5bb5c8d.tar.gz
rockbox-72e08fb838f4277e86b10067b5215551b5bb5c8d.tar.bz2
rockbox-72e08fb838f4277e86b10067b5215551b5bb5c8d.tar.xz
updated remove_thread(), should cover Linus' hints
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4570 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/thread.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index 25141d6..468a957 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -194,6 +194,11 @@ void remove_thread(int threadnum)
thread_stack_size[i] = thread_stack_size[i+1];
thread_contexts[i] = thread_contexts[i+1];
}
+
+ if (current_thread == threadnum) /* deleting the current one? */
+ current_thread = num_threads; /* set beyond last, avoid store harm */
+ else if (current_thread > threadnum) /* within the moved positions? */
+ current_thread--; /* adjust it, point to same context again */
}
void init_threads(void)