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

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

Issue 1406413006: Timeline service protocol support with Observatory UI (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/timeline.h » ('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 #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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 void ThreadPool::Worker::Shutdown() { 411 void ThreadPool::Worker::Shutdown() {
412 MonitorLocker ml(&monitor_); 412 MonitorLocker ml(&monitor_);
413 done_ = true; 413 done_ = true;
414 ml.Notify(); 414 ml.Notify();
415 } 415 }
416 416
417 417
418 // static 418 // static
419 void ThreadPool::Worker::Main(uword args) { 419 void ThreadPool::Worker::Main(uword args) {
420 Thread::EnsureInit(); 420 Thread::EnsureInit();
421 Thread* thread = Thread::Current();
422 thread->set_name("Dart ThreadPool Worker");
421 Worker* worker = reinterpret_cast<Worker*>(args); 423 Worker* worker = reinterpret_cast<Worker*>(args);
422 ThreadId id = OSThread::GetCurrentThreadId(); 424 ThreadId id = OSThread::GetCurrentThreadId();
423 ThreadJoinId join_id = OSThread::GetCurrentThreadJoinId(); 425 ThreadJoinId join_id = OSThread::GetCurrentThreadJoinId();
424 ThreadPool* pool; 426 ThreadPool* pool;
425 427
426 { 428 {
427 MonitorLocker ml(&worker->monitor_); 429 MonitorLocker ml(&worker->monitor_);
428 ASSERT(worker->task_); 430 ASSERT(worker->task_);
429 worker->id_ = id; 431 worker->id_ = id;
430 pool = worker->pool_; 432 pool = worker->pool_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 // is not due to a ThreadPool Shutdown. Thus, we simply delete the worker. 469 // is not due to a ThreadPool Shutdown. Thus, we simply delete the worker.
468 // The worker's id is added to the thread pool's join list by 470 // The worker's id is added to the thread pool's join list by
469 // ReleaseIdleWorker, so in the case that the thread pool begins shutting 471 // ReleaseIdleWorker, so in the case that the thread pool begins shutting
470 // down immediately after returning from worker->Loop() above, we still 472 // down immediately after returning from worker->Loop() above, we still
471 // wait for the thread to exit by joining on it in Shutdown(). 473 // wait for the thread to exit by joining on it in Shutdown().
472 delete worker; 474 delete worker;
473 } 475 }
474 } 476 }
475 477
476 } // namespace dart 478 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698