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

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

Issue 1978153002: Uses an open thread handle as the ThreadJoinId on Windows. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix test Created 4 years, 7 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 | « runtime/vm/os_thread_win.cc ('k') | runtime/vm/thread_pool.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/thread_interrupter.h" 5 #include "vm/thread_interrupter.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/simulator.h" 10 #include "vm/simulator.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ASSERT(initialized_); 150 ASSERT(initialized_);
151 InstallSignalHandler(); 151 InstallSignalHandler();
152 if (FLAG_trace_thread_interrupter) { 152 if (FLAG_trace_thread_interrupter) {
153 OS::Print("ThreadInterrupter thread running.\n"); 153 OS::Print("ThreadInterrupter thread running.\n");
154 } 154 }
155 { 155 {
156 // Signal to main thread we are ready. 156 // Signal to main thread we are ready.
157 MonitorLocker startup_ml(monitor_); 157 MonitorLocker startup_ml(monitor_);
158 OSThread* os_thread = OSThread::Current(); 158 OSThread* os_thread = OSThread::Current();
159 ASSERT(os_thread != NULL); 159 ASSERT(os_thread != NULL);
160 interrupter_thread_id_ = os_thread->join_id(); 160 interrupter_thread_id_ = OSThread::GetCurrentThreadJoinId(os_thread);
161 thread_running_ = true; 161 thread_running_ = true;
162 startup_ml.Notify(); 162 startup_ml.Notify();
163 } 163 }
164 { 164 {
165 intptr_t interrupted_thread_count = 0; 165 intptr_t interrupted_thread_count = 0;
166 MonitorLocker wait_ml(monitor_); 166 MonitorLocker wait_ml(monitor_);
167 current_wait_time_ = interrupt_period_; 167 current_wait_time_ = interrupt_period_;
168 while (!shutdown_) { 168 while (!shutdown_) {
169 intptr_t r = wait_ml.WaitMicros(current_wait_time_); 169 intptr_t r = wait_ml.WaitMicros(current_wait_time_);
170 170
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // Signal to main thread we are exiting. 222 // Signal to main thread we are exiting.
223 MonitorLocker shutdown_ml(monitor_); 223 MonitorLocker shutdown_ml(monitor_);
224 thread_running_ = false; 224 thread_running_ = false;
225 shutdown_ml.Notify(); 225 shutdown_ml.Notify();
226 } 226 }
227 } 227 }
228 228
229 #endif // !PRODUCT 229 #endif // !PRODUCT
230 230
231 } // namespace dart 231 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_win.cc ('k') | runtime/vm/thread_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698