From 72e08fb838f4277e86b10067b5215551b5bb5c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohensohn?= Date: Sat, 1 May 2004 15:36:12 +0000 Subject: [PATCH] updated remove_thread(), should cover Linus' hints git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4570 a1c6a512-1295-4272-9138-f99709370657 --- firmware/thread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firmware/thread.c b/firmware/thread.c index 25141d6f80..468a957d7b 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)