Revision: 24480
Author:   [email protected]
Date:     Thu Oct  9 07:51:35 2014 UTC
Log:      Make Profiler::running_ atomic.

It's used from multiple threads

BUG=none
[email protected]
LOG=n

Review URL: https://codereview.chromium.org/640773002
https://code.google.com/p/v8/source/detail?r=24480

Modified:
 /branches/bleeding_edge/src/log.cc

=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Oct  8 14:08:12 2014 UTC
+++ /branches/bleeding_edge/src/log.cc  Thu Oct  9 07:51:35 2014 UTC
@@ -652,7 +652,7 @@
   bool engaged_;

   // Tells whether worker thread should continue running.
-  bool running_;
+  base::Atomic32 running_;

   // Tells whether we are currently recording tick samples.
   bool paused_;
@@ -703,9 +703,9 @@
       overflow_(false),
       buffer_semaphore_(0),
       engaged_(false),
-      running_(false),
       paused_(false) {
   base::NoBarrier_Store(&tail_, 0);
+  base::NoBarrier_Store(&running_, 0);
 }


@@ -721,7 +721,7 @@
   }

   // Start thread processing the profiler buffer.
-  running_ = true;
+  base::NoBarrier_Store(&running_, 1);
   Start();

   // Register to get ticks.
@@ -741,7 +741,7 @@
   // Terminate the worker thread by setting running_ to false,
   // inserting a fake element in the queue and then wait for
   // the thread to terminate.
-  running_ = false;
+  base::NoBarrier_Store(&running_, 0);
   TickSample sample;
   // Reset 'paused_' flag, otherwise semaphore may not be signalled.
   resume();
@@ -755,7 +755,7 @@
 void Profiler::Run() {
   TickSample sample;
   bool overflow = Remove(&sample);
-  while (running_) {
+  while (base::NoBarrier_Load(&running_)) {
     LOG(isolate_, TickEvent(&sample, overflow));
     overflow = Remove(&sample);
   }

--
--
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