Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2005 05:15:26 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 68374 for review
Message-ID:  <200501060515.j065FQsc077746@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=68374

Change 68374 by davidxu@davidxu_celeron on 2005/01/06 05:14:52

	Return thread pointer eariler since some code assumes new thread
	can use the pointer.(new thread may run before orignal thread returns
	from pthread_create).

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_create.c#4 edit

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_create.c#4 (text+ko) ====

@@ -206,14 +206,14 @@
 			new_thread->sigmask = curthread->sigmask;
 			/* Add the new thread. */
 			_thr_link(curthread, new_thread);
+			/* Return a pointer to the thread structure: */
+			(*thread) = new_thread;
 			ret = thr_create(&uc, &new_thread->tid, 0);
 			__sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
 			if (ret != 0) {
 				_thr_unlink(curthread, new_thread);
 				free_thread(curthread, new_thread);
-			} else {
-				/* Return a pointer to the thread structure: */
-				(*thread) = new_thread;
+				(*thread) = 0;
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501060515.j065FQsc077746>