From ea47ee64f02030c64e0472939ea3c588ce7e8dab Mon Sep 17 00:00:00 2001 From: Catalin Patulea Date: Mon, 1 Oct 2007 04:13:17 +0000 Subject: [PATCH] Watch out for uninitialized threads[] in init_threads() which can cause big headaches later in unrelated places. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14934 a1c6a512-1295-4272-9138-f99709370657 --- firmware/thread.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/firmware/thread.c b/firmware/thread.c index bb3c321ddf..3508a6450d 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -1038,6 +1038,13 @@ void init_threads(void) /* CPU will initialize first and then sleep */ slot = find_empty_thread_slot(); +#if THREAD_EXTRA_CHECKS + /* This can fail if, for example, .bss isn't zero'ed out by the loader + or threads is in the wrong section. */ + if (slot < 0) { + panicf("uninitialized threads[]"); + } +#endif cores[core].sleeping = NULL; cores[core].running = NULL;