summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 7affc2d8..a54f078e 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1749,9 +1749,15 @@ thread_create(struct thread **threadp, const struct thread_attr *attr,
}
thread_init(thread, stack, attr, fn, arg);
- thread_wakeup(thread);
+ /*
+ * The new thread address must be written before the thread is started
+ * in case it's passed to it.
+ */
*threadp = thread;
+
+ thread_wakeup(thread);
+
return 0;
error_stack: