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

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

Issue 1886583002: Add a temporary timeout and print in the safepoint waiter to log if we are stuck waiting for a thre… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/safepoint.h" 5 #include "vm/safepoint.h"
6 6
7 #include "vm/thread.h" 7 #include "vm/thread.h"
8 #include "vm/thread_registry.h" 8 #include "vm/thread_registry.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 } else { 90 } else {
91 current->SetAtSafepoint(true); 91 current->SetAtSafepoint(true);
92 } 92 }
93 current = current->next(); 93 current = current->next();
94 } 94 }
95 } 95 }
96 // Now wait for all threads that are not already at a safepoint to check-in. 96 // Now wait for all threads that are not already at a safepoint to check-in.
97 { 97 {
98 MonitorLocker sl(safepoint_lock_); 98 MonitorLocker sl(safepoint_lock_);
99 intptr_t num_attempts = 0;
99 while (number_threads_not_at_safepoint_ > 0) { 100 while (number_threads_not_at_safepoint_ > 0) {
100 sl.Wait(); 101 Monitor::WaitResult retval = sl.Wait(1000);
102 if (retval == Monitor::kTimedOut) {
103 num_attempts += 1;
104 OS::Print("Attempt:%" Pd " waiting for %d threads to check in\n",
105 num_attempts,
106 number_threads_not_at_safepoint_);
107 }
101 } 108 }
102 } 109 }
103 } 110 }
104 111
105 112
106 void SafepointHandler::ResumeThreads(Thread* T) { 113 void SafepointHandler::ResumeThreads(Thread* T) {
107 // First resume all the threads which are blocked for the safepoint 114 // First resume all the threads which are blocked for the safepoint
108 // operation. 115 // operation.
109 MonitorLocker sl(threads_lock()); 116 MonitorLocker sl(threads_lock());
110 Thread* current = isolate()->thread_registry()->active_list(); 117 Thread* current = isolate()->thread_registry()->active_list();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 while (T->IsSafepointRequested()) { 172 while (T->IsSafepointRequested()) {
166 T->SetBlockedForSafepoint(true); 173 T->SetBlockedForSafepoint(true);
167 tl.Wait(); 174 tl.Wait();
168 T->SetBlockedForSafepoint(false); 175 T->SetBlockedForSafepoint(false);
169 } 176 }
170 T->SetAtSafepoint(false); 177 T->SetAtSafepoint(false);
171 } 178 }
172 } 179 }
173 180
174 } // namespace dart 181 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698