summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-06-03 21:35:06 +0200
committerRichard Braun <rbraun@sceen.net>2013-06-03 21:35:06 +0200
commitd94709584c8fb2c2ad6df3349629e125b6276ed7 (patch)
treed7b08413ce7aa493463afcda3ae6e6670d385d49
parent80a672a4692369ad7226905a7c083b2b0107782a (diff)
kern/thread: fix thread creation
-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: