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

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

Issue 1533023002: - Make sure to prepare all threads for GC. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« runtime/vm/thread.cc ('K') | « runtime/vm/thread_registry.cc ('k') | no next file » | 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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/isolate.h" 6 #include "vm/isolate.h"
7 #include "vm/lockers.h" 7 #include "vm/lockers.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 #include "vm/profiler.h" 9 #include "vm/profiler.h"
10 #include "vm/thread_pool.h" 10 #include "vm/thread_pool.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 564
565 TEST_CASE(HelperAllocAndGC) { 565 TEST_CASE(HelperAllocAndGC) {
566 Monitor done_monitor; 566 Monitor done_monitor;
567 bool done = false; 567 bool done = false;
568 Isolate* isolate = Thread::Current()->isolate(); 568 Isolate* isolate = Thread::Current()->isolate();
569 // Flush store buffers, etc. 569 // Flush store buffers, etc.
570 // TODO(koda): Currently, the GC only does this for the current thread, (i.e, 570 // TODO(koda): Currently, the GC only does this for the current thread, (i.e,
571 // the helper, in this test), but it should be done for all *threads* 571 // the helper, in this test), but it should be done for all *threads*
572 // while reaching a safepoint. 572 // while reaching a safepoint.
573 Thread::PrepareForGC(); 573 isolate->thread_registry()->PrepareForGC();
574 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done)); 574 Dart::thread_pool()->Run(new AllocAndGCTask(isolate, &done_monitor, &done));
575 { 575 {
576 while (true) { 576 while (true) {
577 isolate->thread_registry()->CheckSafepoint(); 577 isolate->thread_registry()->CheckSafepoint();
578 MonitorLocker ml(&done_monitor); 578 MonitorLocker ml(&done_monitor);
579 if (done) { 579 if (done) {
580 break; 580 break;
581 } 581 }
582 } 582 }
583 } 583 }
584 } 584 }
585 585
586 } // namespace dart 586 } // namespace dart
OLDNEW
« runtime/vm/thread.cc ('K') | « runtime/vm/thread_registry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698