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

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

Issue 1807293002: - Fix for issue 25950 (add registration of a thread exit callback) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 9 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
« no previous file with comments | « runtime/vm/random.cc ('k') | runtime/vm/timeline.cc » ('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/dart.h"
7 #include "vm/flags.h" 8 #include "vm/flags.h"
8 #include "vm/lockers.h" 9 #include "vm/lockers.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 DEFINE_FLAG(int, worker_timeout_millis, 5000, 13 DEFINE_FLAG(int, worker_timeout_millis, 5000,
13 "Free workers when they have been idle for this amount of time."); 14 "Free workers when they have been idle for this amount of time.");
14 15
15 ThreadPool::ThreadPool() 16 ThreadPool::ThreadPool()
16 : shutting_down_(false), 17 : shutting_down_(false),
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 474 }
474 } else { 475 } else {
475 // This worker is going down because it was idle for too long. This case 476 // This worker is going down because it was idle for too long. This case
476 // is not due to a ThreadPool Shutdown. Thus, we simply delete the worker. 477 // is not due to a ThreadPool Shutdown. Thus, we simply delete the worker.
477 // The worker's id is added to the thread pool's join list by 478 // The worker's id is added to the thread pool's join list by
478 // ReleaseIdleWorker, so in the case that the thread pool begins shutting 479 // ReleaseIdleWorker, so in the case that the thread pool begins shutting
479 // down immediately after returning from worker->Loop() above, we still 480 // down immediately after returning from worker->Loop() above, we still
480 // wait for the thread to exit by joining on it in Shutdown(). 481 // wait for the thread to exit by joining on it in Shutdown().
481 delete worker; 482 delete worker;
482 } 483 }
484
485 // Call the thread exit hook here to notify the embedder that the
486 // thread pool thread is exiting.
487 if (Dart::thread_exit_callback() != NULL) {
488 (*Dart::thread_exit_callback())();
489 }
483 } 490 }
484 491
485 } // namespace dart 492 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/random.cc ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698