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

Side by Side Diff: runtime/vm/thread_pool.cc

Issue 9924015: Use the ThreadPool for all isolates and native ports. Previously, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/port_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 namespace dart { 7 namespace dart {
8 8
9 DEFINE_FLAG(int, worker_timeout_millis, 5000, 9 DEFINE_FLAG(int, worker_timeout_millis, 5000,
10 "Free workers when they have been idle for this amount of time."); 10 "Free workers when they have been idle for this amount of time.");
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 222
223 void ThreadPool::Worker::StartThread() { 223 void ThreadPool::Worker::StartThread() {
224 #if defined(DEBUG) 224 #if defined(DEBUG)
225 // Must call SetTask before StartThread. 225 // Must call SetTask before StartThread.
226 { // NOLINT 226 { // NOLINT
227 MonitorLocker ml(&monitor_); 227 MonitorLocker ml(&monitor_);
228 ASSERT(task_ != NULL); 228 ASSERT(task_ != NULL);
229 } 229 }
230 #endif 230 #endif
231 Thread::Start(&Worker::Main, reinterpret_cast<uword>(this)); 231 int result = Thread::Start(&Worker::Main, reinterpret_cast<uword>(this));
232 if (result != 0) {
233 FATAL1("Could not start worker thread: result = %d.", result);
234 }
232 } 235 }
233 236
234 237
235 void ThreadPool::Worker::SetTask(Task* task) { 238 void ThreadPool::Worker::SetTask(Task* task) {
236 MonitorLocker ml(&monitor_); 239 MonitorLocker ml(&monitor_);
237 ASSERT(task_ == NULL); 240 ASSERT(task_ == NULL);
238 task_ = task; 241 task_ = task;
239 ml.Notify(); 242 ml.Notify();
240 } 243 }
241 244
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // The exit monitor is only used during testing. 322 // The exit monitor is only used during testing.
320 if (ThreadPool::exit_monitor_) { 323 if (ThreadPool::exit_monitor_) {
321 MonitorLocker ml(ThreadPool::exit_monitor_); 324 MonitorLocker ml(ThreadPool::exit_monitor_);
322 (*ThreadPool::exit_count_)++; 325 (*ThreadPool::exit_count_)++;
323 ml.Notify(); 326 ml.Notify();
324 } 327 }
325 delete worker; 328 delete worker;
326 } 329 }
327 330
328 } // namespace dart 331 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/port_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698