Chromium Code Reviews| Index: runtime/vm/thread_pool.cc |
| diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc |
| index 40ca9d57ec344bd7763db51a9c4a53ab695dd953..8377894d7e8be75143ab373a83df6090c710c690 100644 |
| --- a/runtime/vm/thread_pool.cc |
| +++ b/runtime/vm/thread_pool.cc |
| @@ -11,8 +11,8 @@ |
| namespace dart { |
| DEFINE_FLAG(int, |
| - worker_timeout_millis, |
| - 5000, |
| + worker_timeout_micros, |
| + 5000000, |
|
Cutch
2016/12/15 22:59:24
consider keeping the command line flag backwards c
rmacnak
2016/12/15 23:11:27
Done.
|
| "Free workers when they have been idle for this amount of time."); |
| ThreadPool::ThreadPool() |
| @@ -370,18 +370,18 @@ void ThreadPool::Worker::SetTask(Task* task) { |
| static int64_t ComputeTimeout(int64_t idle_start) { |
| - if (FLAG_worker_timeout_millis <= 0) { |
| + if (FLAG_worker_timeout_micros <= 0) { |
| // No timeout. |
| return 0; |
| } else { |
| - int64_t waited = OS::GetCurrentTimeMillis() - idle_start; |
| - if (waited >= FLAG_worker_timeout_millis) { |
| + int64_t waited = OS::GetCurrentMonotonicMicros() - idle_start; |
| + if (waited >= FLAG_worker_timeout_micros) { |
| // We must have gotten a spurious wakeup just before we timed |
| // out. Give the worker one last desperate chance to live. We |
| // are merciful. |
| return 1; |
| } else { |
| - return FLAG_worker_timeout_millis - waited; |
| + return FLAG_worker_timeout_micros - waited; |
| } |
| } |
| } |
| @@ -408,9 +408,9 @@ bool ThreadPool::Worker::Loop() { |
| } |
| ASSERT(!done_); |
| pool_->SetIdleAndReapExited(this); |
| - idle_start = OS::GetCurrentTimeMillis(); |
| + idle_start = OS::GetCurrentMonotonicMicros(); |
| while (true) { |
| - Monitor::WaitResult result = ml.Wait(ComputeTimeout(idle_start)); |
| + Monitor::WaitResult result = ml.WaitMicros(ComputeTimeout(idle_start)); |
| if (task_ != NULL) { |
| // We've found a task. Process it, regardless of whether the |
| // worker is done_. |