Commit 3a7cf7eb authored by yurys@chromium.org's avatar yurys@chromium.org

Make sure semaphore used in Profiler is deleted

BUG=None
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/23420004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16330 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b2621dbd
......@@ -560,6 +560,14 @@ class Profiler: public Thread {
}
}
virtual void Run();
// Pause and Resume TickSample data collection.
bool paused() const { return paused_; }
void pause() { paused_ = true; }
void resume() { paused_ = false; }
private:
// Waits for a signal and removes profiling data.
bool Remove(TickSample* sample) {
buffer_semaphore_->Wait(); // Wait for an element.
......@@ -570,14 +578,6 @@ class Profiler: public Thread {
return result;
}
void Run();
// Pause and Resume TickSample data collection.
bool paused() const { return paused_; }
void pause() { paused_ = true; }
void resume() { paused_ = false; }
private:
// Returns the next index in the cyclic buffer.
int Succ(int index) { return (index + 1) % kBufferSize; }
......@@ -589,7 +589,8 @@ class Profiler: public Thread {
int head_; // Index to the buffer head.
int tail_; // Index to the buffer tail.
bool overflow_; // Tell whether a buffer overflow has occurred.
Semaphore* buffer_semaphore_; // Sempahore used for buffer synchronization.
// Sempahore used for buffer synchronization.
SmartPointer<Semaphore> buffer_semaphore_;
// Tells whether profiler is engaged, that is, processing thread is stated.
bool engaged_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment