diff options
-rw-r--r-- | firmware/thread.c | 5 |
1 files changed, 5 insertions, 0 deletions
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) | |||
194 | thread_stack_size[i] = thread_stack_size[i+1]; | 194 | thread_stack_size[i] = thread_stack_size[i+1]; |
195 | thread_contexts[i] = thread_contexts[i+1]; | 195 | thread_contexts[i] = thread_contexts[i+1]; |
196 | } | 196 | } |
197 | |||
198 | if (current_thread == threadnum) /* deleting the current one? */ | ||
199 | current_thread = num_threads; /* set beyond last, avoid store harm */ | ||
200 | else if (current_thread > threadnum) /* within the moved positions? */ | ||
201 | current_thread--; /* adjust it, point to same context again */ | ||
197 | } | 202 | } |
198 | 203 | ||
199 | void init_threads(void) | 204 | void init_threads(void) |