Bug 1347644 - Baldr: fix race in POSIX Thread impl (r=till)
authorLuke Wagner <luke@mozilla.com>
Fri, 06 Oct 2017 10:40:51 -0500
changeset 384759 f61947de473fa09f3a8aba90ee6eab92d5f0ad80
parent 384758 c504f7082a1f4238a7951131b6a793e6c41e198a
child 384760 6c386d38608af90a93907b01eb6b0082e67463b0
push id32634
push userkwierso@gmail.com
push dateFri, 06 Oct 2017 19:55:44 +0000
treeherdermozilla-central@2d7b8b5dd174 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1347644
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1347644 - Baldr: fix race in POSIX Thread impl (r=till) MozReview-Commit-ID: K0oRcTtuPbO
js/src/threading/posix/Thread.cpp
--- a/js/src/threading/posix/Thread.cpp
+++ b/js/src/threading/posix/Thread.cpp
@@ -96,23 +96,23 @@ js::Thread::create(void* (*aMain)(void*)
 {
   pthread_attr_t attrs;
   int r = pthread_attr_init(&attrs);
   MOZ_RELEASE_ASSERT(!r);
   if (options_.stackSize()) {
     r = pthread_attr_setstacksize(&attrs, options_.stackSize());
     MOZ_RELEASE_ASSERT(!r);
   }
+  id_.platformData()->hasThread = true;
   r = pthread_create(&id_.platformData()->ptThread, &attrs, aMain, aArg);
   if (r) {
     // |pthread_create| may leave id_ in an undefined state.
     id_ = Id();
     return false;
   }
-  id_.platformData()->hasThread = true;
   return true;
 }
 
 void
 js::Thread::join()
 {
   MOZ_RELEASE_ASSERT(joinable());
   int r = pthread_join(id_.platformData()->ptThread, nullptr);