Index: runtime/vm/thread_pool.cc |
diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc |
index 4c73446f0c5f78fd240f766636d228d47a976a6e..89fa33a0912b7711fe72d1b2e6ddf6eebea888b9 100644 |
--- a/runtime/vm/thread_pool.cc |
+++ b/runtime/vm/thread_pool.cc |
@@ -26,12 +26,10 @@ ThreadPool::ThreadPool() |
shutting_down_workers_(NULL), |
join_list_(NULL) {} |
- |
ThreadPool::~ThreadPool() { |
Shutdown(); |
} |
- |
bool ThreadPool::Run(Task* task) { |
Worker* worker = NULL; |
bool new_worker = false; |
@@ -73,7 +71,6 @@ bool ThreadPool::Run(Task* task) { |
return true; |
} |
- |
void ThreadPool::Shutdown() { |
Worker* saved = NULL; |
{ |
@@ -144,7 +141,6 @@ void ThreadPool::Shutdown() { |
#endif |
} |
- |
bool ThreadPool::IsIdle(Worker* worker) { |
ASSERT(worker != NULL && worker->owned_); |
for (Worker* current = idle_workers_; current != NULL; |
@@ -156,7 +152,6 @@ bool ThreadPool::IsIdle(Worker* worker) { |
return false; |
} |
- |
bool ThreadPool::RemoveWorkerFromIdleList(Worker* worker) { |
ASSERT(worker != NULL && worker->owned_); |
if (idle_workers_ == NULL) { |
@@ -181,7 +176,6 @@ bool ThreadPool::RemoveWorkerFromIdleList(Worker* worker) { |
return false; |
} |
- |
bool ThreadPool::RemoveWorkerFromAllList(Worker* worker) { |
ASSERT(worker != NULL && worker->owned_); |
if (all_workers_ == NULL) { |
@@ -209,7 +203,6 @@ bool ThreadPool::RemoveWorkerFromAllList(Worker* worker) { |
return false; |
} |
- |
void ThreadPool::SetIdleLocked(Worker* worker) { |
ASSERT(mutex_.IsOwnedByCurrentThread()); |
ASSERT(worker->owned_ && !IsIdle(worker)); |
@@ -219,7 +212,6 @@ void ThreadPool::SetIdleLocked(Worker* worker) { |
count_running_--; |
} |
- |
void ThreadPool::SetIdleAndReapExited(Worker* worker) { |
JoinList* list = NULL; |
{ |
@@ -248,7 +240,6 @@ void ThreadPool::SetIdleAndReapExited(Worker* worker) { |
} |
} |
- |
bool ThreadPool::ReleaseIdleWorker(Worker* worker) { |
MutexLocker ml(&mutex_); |
if (shutting_down_) { |
@@ -273,7 +264,6 @@ bool ThreadPool::ReleaseIdleWorker(Worker* worker) { |
return true; |
} |
- |
// Only call while holding the exit_monitor_ |
void ThreadPool::AddWorkerToShutdownList(Worker* worker) { |
ASSERT(exit_monitor_.IsOwnedByCurrentThread()); |
@@ -281,7 +271,6 @@ void ThreadPool::AddWorkerToShutdownList(Worker* worker) { |
shutting_down_workers_ = worker; |
} |
- |
// Only call while holding the exit_monitor_ |
bool ThreadPool::RemoveWorkerFromShutdownList(Worker* worker) { |
ASSERT(worker != NULL); |
@@ -306,12 +295,10 @@ bool ThreadPool::RemoveWorkerFromShutdownList(Worker* worker) { |
return false; |
} |
- |
void ThreadPool::JoinList::AddLocked(ThreadJoinId id, JoinList** list) { |
*list = new JoinList(id, *list); |
} |
- |
void ThreadPool::JoinList::Join(JoinList** list) { |
while (*list != NULL) { |
JoinList* current = *list; |
@@ -321,13 +308,10 @@ void ThreadPool::JoinList::Join(JoinList** list) { |
} |
} |
- |
ThreadPool::Task::Task() {} |
- |
ThreadPool::Task::~Task() {} |
- |
ThreadPool::Worker::Worker(ThreadPool* pool) |
: pool_(pool), |
task_(NULL), |
@@ -338,13 +322,11 @@ ThreadPool::Worker::Worker(ThreadPool* pool) |
idle_next_(NULL), |
shutdown_next_(NULL) {} |
- |
ThreadId ThreadPool::Worker::id() { |
MonitorLocker ml(&monitor_); |
return id_; |
} |
- |
void ThreadPool::Worker::StartThread() { |
#if defined(DEBUG) |
// Must call SetTask before StartThread. |
@@ -360,7 +342,6 @@ void ThreadPool::Worker::StartThread() { |
} |
} |
- |
void ThreadPool::Worker::SetTask(Task* task) { |
MonitorLocker ml(&monitor_); |
ASSERT(task_ == NULL); |
@@ -368,7 +349,6 @@ void ThreadPool::Worker::SetTask(Task* task) { |
ml.Notify(); |
} |
- |
static int64_t ComputeTimeout(int64_t idle_start) { |
int64_t worker_timeout_micros = |
FLAG_worker_timeout_millis * kMicrosecondsPerMillisecond; |
@@ -388,7 +368,6 @@ static int64_t ComputeTimeout(int64_t idle_start) { |
} |
} |
- |
bool ThreadPool::Worker::Loop() { |
MonitorLocker ml(&monitor_); |
int64_t idle_start; |
@@ -430,14 +409,12 @@ bool ThreadPool::Worker::Loop() { |
return false; |
} |
- |
void ThreadPool::Worker::Shutdown() { |
MonitorLocker ml(&monitor_); |
done_ = true; |
ml.Notify(); |
} |
- |
// static |
void ThreadPool::Worker::Main(uword args) { |
Worker* worker = reinterpret_cast<Worker*>(args); |