aboutsummaryrefslogtreecommitdiff
path: root/src/lib/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/thread.c')
-rw-r--r--src/lib/thread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/thread.c b/src/lib/thread.c
index e2280c63fe..782a63ea52 100644
--- a/src/lib/thread.c
+++ b/src/lib/thread.c
@@ -9,6 +9,8 @@
#include <thread.h>
#include <timer.h>
+static bool initialized;
+
static void idle_thread_init(void);
/* There needs to be at least one thread to run the ramstate state machine. */
@@ -40,6 +42,9 @@ static inline struct thread *cpu_info_to_thread(const struct cpu_info *ci)
static inline struct thread *current_thread(void)
{
+ if (!initialized)
+ return NULL;
+
return cpu_info_to_thread(cpu_info());
}
@@ -265,6 +270,8 @@ void threads_initialize(void)
free_thread(t);
}
+ initialized = 1;
+
idle_thread_init();
}