| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Thread* current = isolate()->thread_registry()->active_list(); | 75 Thread* current = isolate()->thread_registry()->active_list(); |
| 76 while (current != NULL) { | 76 while (current != NULL) { |
| 77 MonitorLocker tl(current->thread_lock()); | 77 MonitorLocker tl(current->thread_lock()); |
| 78 if (current != T) { | 78 if (current != T) { |
| 79 uint32_t state = current->SetSafepointRequested(true); | 79 uint32_t state = current->SetSafepointRequested(true); |
| 80 if (!Thread::IsAtSafepoint(state)) { | 80 if (!Thread::IsAtSafepoint(state)) { |
| 81 // Thread is not already at a safepoint so try to | 81 // Thread is not already at a safepoint so try to |
| 82 // get it to a safepoint and wait for it to check in. | 82 // get it to a safepoint and wait for it to check in. |
| 83 if (current->IsMutatorThread()) { | 83 if (current->IsMutatorThread()) { |
| 84 ASSERT(T->isolate() != NULL); | 84 ASSERT(T->isolate() != NULL); |
| 85 T->isolate()->ScheduleInterrupts(Isolate::kVMInterrupt); | 85 current->ScheduleInterruptsLocked(Thread::kVMInterrupt); |
| 86 } | 86 } |
| 87 MonitorLocker sl(safepoint_lock_); | 87 MonitorLocker sl(safepoint_lock_); |
| 88 ++number_threads_not_at_safepoint_; | 88 ++number_threads_not_at_safepoint_; |
| 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 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 while (T->IsSafepointRequested()) { | 165 while (T->IsSafepointRequested()) { |
| 166 T->SetBlockedForSafepoint(true); | 166 T->SetBlockedForSafepoint(true); |
| 167 tl.Wait(); | 167 tl.Wait(); |
| 168 T->SetBlockedForSafepoint(false); | 168 T->SetBlockedForSafepoint(false); |
| 169 } | 169 } |
| 170 T->SetAtSafepoint(false); | 170 T->SetAtSafepoint(false); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace dart | 174 } // namespace dart |
| OLD | NEW |