| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/thread_pool.h" | 5 #include "vm/thread_pool.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/lockers.h" | 8 #include "vm/lockers.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 | 225 |
| 226 void ThreadPool::Worker::StartThread() { | 226 void ThreadPool::Worker::StartThread() { |
| 227 #if defined(DEBUG) | 227 #if defined(DEBUG) |
| 228 // Must call SetTask before StartThread. | 228 // Must call SetTask before StartThread. |
| 229 { // NOLINT | 229 { // NOLINT |
| 230 MonitorLocker ml(&monitor_); | 230 MonitorLocker ml(&monitor_); |
| 231 ASSERT(task_ != NULL); | 231 ASSERT(task_ != NULL); |
| 232 } | 232 } |
| 233 #endif | 233 #endif |
| 234 int result = Thread::Start(&Worker::Main, reinterpret_cast<uword>(this)); | 234 int result = OSThread::Start(&Worker::Main, reinterpret_cast<uword>(this)); |
| 235 if (result != 0) { | 235 if (result != 0) { |
| 236 FATAL1("Could not start worker thread: result = %d.", result); | 236 FATAL1("Could not start worker thread: result = %d.", result); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 | 240 |
| 241 void ThreadPool::Worker::SetTask(Task* task) { | 241 void ThreadPool::Worker::SetTask(Task* task) { |
| 242 MonitorLocker ml(&monitor_); | 242 MonitorLocker ml(&monitor_); |
| 243 ASSERT(task_ == NULL); | 243 ASSERT(task_ == NULL); |
| 244 task_ = task; | 244 task_ = task; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // The exit monitor is only used during testing. | 325 // The exit monitor is only used during testing. |
| 326 if (ThreadPool::exit_monitor_) { | 326 if (ThreadPool::exit_monitor_) { |
| 327 MonitorLocker ml(ThreadPool::exit_monitor_); | 327 MonitorLocker ml(ThreadPool::exit_monitor_); |
| 328 (*ThreadPool::exit_count_)++; | 328 (*ThreadPool::exit_count_)++; |
| 329 ml.Notify(); | 329 ml.Notify(); |
| 330 } | 330 } |
| 331 delete worker; | 331 delete worker; |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace dart | 334 } // namespace dart |
| OLD | NEW |