Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2161)

Unified Diff: src/log.cc

Issue 640773002: Make Profiler::running_ atomic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 265895aeef7a5f6420a2c5b883b5868b17a26e7f..0af1c9f03d1b04b8a3b2e6af7a54ebb4bdc570bd 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -652,7 +652,7 @@ class Profiler: public base::Thread {
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 @@ Profiler::Profiler(Isolate* isolate)
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 @@ void Profiler::Engage() {
}
// Start thread processing the profiler buffer.
- running_ = true;
+ base::NoBarrier_Store(&running_, 1);
Start();
// Register to get ticks.
@@ -741,7 +741,7 @@ void Profiler::Disengage() {
// 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::Disengage() {
void Profiler::Run() {
TickSample sample;
bool overflow = Remove(&sample);
- while (running_) {
+ while (base::NoBarrier_Load(&running_)) {
LOG(isolate_, TickEvent(&sample, overflow));
overflow = Remove(&sample);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698