Reviewers: antonm,

Description:
Fix issue 833: eliminate race condition in ProfilerEventsProcessor.

When under a load, the ProfilerEventsProcessor thread can start
(enter Run) after Stop has been called, thus resetting running_
data member back to 'true', and starting an infinite loop.

BUG=833

Please review this at http://codereview.chromium.org/3157022/show

Affected files:
  M src/cpu-profiler.cc


Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 3e554ccebdc9faa9190313feb7374e78312ffb1f..c0ed9297a2dd966a5daf9a5b7046e2ac2601c04a 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -46,7 +46,7 @@ static const int kTickSamplesBufferChunksCount = 16;

ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator)
     : generator_(generator),
-      running_(false),
+      running_(true),
       ticks_buffer_(sizeof(TickSampleEventRecord),
                     kTickSamplesBufferChunkSize,
                     kTickSamplesBufferChunksCount),
@@ -247,7 +247,6 @@ bool ProfilerEventsProcessor::ProcessTicks(unsigned dequeue_order) {

 void ProfilerEventsProcessor::Run() {
   unsigned dequeue_order = 0;
-  running_ = true;

   while (running_) {
     // Process ticks until we have any.


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to