summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-04-04 07:27:29 +0000
committerjb <jb@FreeBSD.org>1998-04-04 07:27:29 +0000
commitfc00c3e3585ad7b492eaa63a9459f087eb3abf8f (patch)
treed2da798ea5625934920f3cfffa972d12717228a1 /lib/libpthread
parentda94b5035523f984cb9a96121aa8c8d3bac9dcbb (diff)
downloadFreeBSD-src-fc00c3e3585ad7b492eaa63a9459f087eb3abf8f.zip
FreeBSD-src-fc00c3e3585ad7b492eaa63a9459f087eb3abf8f.tar.gz
Move the magic field initialisation to a place when it is more magic.
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_create.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c
index 412f558..3dcd944 100644
--- a/lib/libpthread/thread/thr_create.c
+++ b/lib/libpthread/thread/thr_create.c
@@ -60,12 +60,6 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr,
/* Insufficient memory to create a thread: */
ret = EAGAIN;
} else {
- /*
- * Write a magic value to the thread structure to help
- * identify valid ones:
- */
- new_thread->magic = PTHREAD_MAGIC;
-
/* Check if default thread attributes are required: */
if (attr == NULL || *attr == NULL) {
/* Use the default thread attributes: */
@@ -92,6 +86,13 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr,
new_thread->stack = stack;
new_thread->start_routine = start_routine;
new_thread->arg = arg;
+
+ /*
+ * Write a magic value to the thread structure
+ * to help identify valid ones:
+ */
+ new_thread->magic = PTHREAD_MAGIC;
+
if (pattr->suspend == PTHREAD_CREATE_SUSPENDED) {
PTHREAD_NEW_STATE(new_thread,PS_SUSPENDED);
} else {
OpenPOWER on IntegriCloud