Revision: 19933
Author:   [email protected]
Date:     Fri Mar 14 12:46:30 2014 UTC
Log:      Make thread_creation_mutex a Thread::PlatformData member.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/198643003
http://code.google.com/p/v8/source/detail?r=19933

Modified:
 /branches/bleeding_edge/src/platform-posix.cc

=======================================
--- /branches/bleeding_edge/src/platform-posix.cc Fri Mar 14 10:51:16 2014 UTC +++ /branches/bleeding_edge/src/platform-posix.cc Fri Mar 14 12:46:30 2014 UTC
@@ -565,6 +565,8 @@
  public:
   PlatformData() : thread_(kNoThread) {}
   pthread_t thread_;  // Thread handle for pthread.
+  // Synchronizes thread creation
+  Mutex thread_creation_mutex_;
 };

 Thread::Thread(const Options& options)
@@ -581,10 +583,6 @@
 Thread::~Thread() {
   delete data_;
 }
-
-
-// Synchronizes thread creation
-static Mutex thread_creation_mutex_;


 static void SetThreadName(const char* name) {
@@ -619,7 +617,7 @@
// We take the lock here to make sure that pthread_create finished first since // we don't know which thread will run first (the original thread or the new
   // one).
-  { LockGuard<Mutex> lock_guard(&thread_creation_mutex_); }
+  { LockGuard<Mutex> lock_guard(&thread->data()->thread_creation_mutex_); }
   SetThreadName(thread->name());
   ASSERT(thread->data()->thread_ != kNoThread);
   thread->NotifyStartedAndRun();
@@ -647,7 +645,7 @@
   }
 #endif
   {
-    LockGuard<Mutex> lock_guard(&thread_creation_mutex_);
+    LockGuard<Mutex> lock_guard(&data_->thread_creation_mutex_);
     result = pthread_create(&data_->thread_, &attr, ThreadEntry, this);
   }
   ASSERT_EQ(0, result);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to