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

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

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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/safepoint.h ('k') | runtime/vm/scanner.h » ('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) 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 24 matching lines...) Expand all
35 ASSERT(handler != NULL); 35 ASSERT(handler != NULL);
36 handler->ResumeThreads(T); 36 handler->ResumeThreads(T);
37 } 37 }
38 38
39 39
40 SafepointHandler::SafepointHandler(Isolate* isolate) 40 SafepointHandler::SafepointHandler(Isolate* isolate)
41 : isolate_(isolate), 41 : isolate_(isolate),
42 safepoint_lock_(new Monitor()), 42 safepoint_lock_(new Monitor()),
43 number_threads_not_at_safepoint_(0), 43 number_threads_not_at_safepoint_(0),
44 safepoint_operation_count_(0), 44 safepoint_operation_count_(0),
45 owner_(NULL) { 45 owner_(NULL) {}
46 }
47 46
48 47
49 SafepointHandler::~SafepointHandler() { 48 SafepointHandler::~SafepointHandler() {
50 ASSERT(owner_ == NULL); 49 ASSERT(owner_ == NULL);
51 ASSERT(safepoint_operation_count_ == 0); 50 ASSERT(safepoint_operation_count_ == 0);
52 delete safepoint_lock_; 51 delete safepoint_lock_;
53 safepoint_lock_ = NULL; 52 safepoint_lock_ = NULL;
54 isolate_ = NULL; 53 isolate_ = NULL;
55 } 54 }
56 55
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 MonitorLocker sl(safepoint_lock_); 106 MonitorLocker sl(safepoint_lock_);
108 intptr_t num_attempts = 0; 107 intptr_t num_attempts = 0;
109 while (number_threads_not_at_safepoint_ > 0) { 108 while (number_threads_not_at_safepoint_ > 0) {
110 Monitor::WaitResult retval = sl.Wait(1000); 109 Monitor::WaitResult retval = sl.Wait(1000);
111 if (retval == Monitor::kTimedOut) { 110 if (retval == Monitor::kTimedOut) {
112 num_attempts += 1; 111 num_attempts += 1;
113 if (num_attempts > 10) { 112 if (num_attempts > 10) {
114 // We have been waiting too long, start logging this as we might 113 // We have been waiting too long, start logging this as we might
115 // have an issue where a thread is not checking in for a safepoint. 114 // 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", 115 OS::Print("Attempt:%" Pd " waiting for %d threads to check in\n",
117 num_attempts, 116 num_attempts, number_threads_not_at_safepoint_);
118 number_threads_not_at_safepoint_);
119 } 117 }
120 } 118 }
121 } 119 }
122 } 120 }
123 } 121 }
124 122
125 123
126 void SafepointHandler::ResumeThreads(Thread* T) { 124 void SafepointHandler::ResumeThreads(Thread* T) {
127 // First resume all the threads which are blocked for the safepoint 125 // First resume all the threads which are blocked for the safepoint
128 // operation. 126 // operation.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 while (T->IsSafepointRequested()) { 191 while (T->IsSafepointRequested()) {
194 T->SetBlockedForSafepoint(true); 192 T->SetBlockedForSafepoint(true);
195 tl.Wait(); 193 tl.Wait();
196 T->SetBlockedForSafepoint(false); 194 T->SetBlockedForSafepoint(false);
197 } 195 }
198 T->SetAtSafepoint(false); 196 T->SetAtSafepoint(false);
199 } 197 }
200 } 198 }
201 199
202 } // namespace dart 200 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/safepoint.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698