PERFORCE change 68374 for review

David Xu davidxu at FreeBSD.org
Wed Jan 5 21:15:27 PST 2005


http://perforce.freebsd.org/chv.cgi?CH=68374

Change 68374 by davidxu at 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;
 			}
 		}
 	}


More information about the p4-projects mailing list