| OLD | NEW |
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 // Now wait for all threads that are not already at a safepoint to check-in. | 105 // Now wait for all threads that are not already at a safepoint to check-in. |
| 106 { | 106 { |
| 107 MonitorLocker sl(safepoint_lock_); | 107 MonitorLocker sl(safepoint_lock_); |
| 108 intptr_t num_attempts = 0; | 108 intptr_t num_attempts = 0; |
| 109 while (number_threads_not_at_safepoint_ > 0) { | 109 while (number_threads_not_at_safepoint_ > 0) { |
| 110 Monitor::WaitResult retval = sl.Wait(1000); | 110 Monitor::WaitResult retval = sl.Wait(1000); |
| 111 if (retval == Monitor::kTimedOut) { | 111 if (retval == Monitor::kTimedOut) { |
| 112 num_attempts += 1; | 112 num_attempts += 1; |
| 113 OS::Print("Attempt:%" Pd " waiting for %d threads to check in\n", | 113 if (num_attempts > 10) { |
| 114 num_attempts, | 114 // We have been waiting too long, start logging this as we might |
| 115 number_threads_not_at_safepoint_); | 115 // have an issue where a thread is not checking in for a safepoint. |
| 116 OS::Print("Attempt:%" Pd " waiting for %d threads to check in\n", |
| 117 num_attempts, |
| 118 number_threads_not_at_safepoint_); |
| 119 } |
| 116 } | 120 } |
| 117 } | 121 } |
| 118 } | 122 } |
| 119 } | 123 } |
| 120 | 124 |
| 121 | 125 |
| 122 void SafepointHandler::ResumeThreads(Thread* T) { | 126 void SafepointHandler::ResumeThreads(Thread* T) { |
| 123 // First resume all the threads which are blocked for the safepoint | 127 // First resume all the threads which are blocked for the safepoint |
| 124 // operation. | 128 // operation. |
| 125 MonitorLocker sl(threads_lock()); | 129 MonitorLocker sl(threads_lock()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 while (T->IsSafepointRequested()) { | 193 while (T->IsSafepointRequested()) { |
| 190 T->SetBlockedForSafepoint(true); | 194 T->SetBlockedForSafepoint(true); |
| 191 tl.Wait(); | 195 tl.Wait(); |
| 192 T->SetBlockedForSafepoint(false); | 196 T->SetBlockedForSafepoint(false); |
| 193 } | 197 } |
| 194 T->SetAtSafepoint(false); | 198 T->SetAtSafepoint(false); |
| 195 } | 199 } |
| 196 } | 200 } |
| 197 | 201 |
| 198 } // namespace dart | 202 } // namespace dart |
| OLD | NEW |