am cbeccc84: am 200de748: Merge "Fix race condition in pthread_create()"
* commit 'cbeccc849a45ac9adc124a6d1781c1ddc7bad54e':
Fix race condition in pthread_create()
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 2e2c09d..40a09ba 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -364,10 +364,10 @@
_thread_created_hook(tid);
pthread_mutex_unlock(&gDebuggerNotificationLock);
- // Let the thread run.
+ // Publish the pthread_t and let the thread run.
+ *thread_out = (pthread_t) thread;
pthread_mutex_unlock(start_mutex);
- *thread_out = (pthread_t) thread;
return 0;
}