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

Review URL: http://codereview.chromium.org/3157022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2010-08-18 15:36:00 +00:00
parent 2f76132ae8
commit 25bdc16f9f

View File

@ -46,7 +46,7 @@ static const int kTickSamplesBufferChunksCount = 16;
ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator)
: generator_(generator), : generator_(generator),
running_(false), running_(true),
ticks_buffer_(sizeof(TickSampleEventRecord), ticks_buffer_(sizeof(TickSampleEventRecord),
kTickSamplesBufferChunkSize, kTickSamplesBufferChunkSize,
kTickSamplesBufferChunksCount), kTickSamplesBufferChunksCount),
@ -247,7 +247,6 @@ bool ProfilerEventsProcessor::ProcessTicks(unsigned dequeue_order) {
void ProfilerEventsProcessor::Run() { void ProfilerEventsProcessor::Run() {
unsigned dequeue_order = 0; unsigned dequeue_order = 0;
running_ = true;
while (running_) { while (running_) {
// Process ticks until we have any. // Process ticks until we have any.