| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/globals.h" | 7 #include "vm/globals.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
| 10 #include "vm/thread_pool.h" | 10 #include "vm/thread_pool.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 Isolate* isolate_; | 144 Isolate* isolate_; |
| 145 Monitor* awake_monitor_; | 145 Monitor* awake_monitor_; |
| 146 bool* awake_; | 146 bool* awake_; |
| 147 Monitor* round_monitor_; | 147 Monitor* round_monitor_; |
| 148 const intptr_t* round_; | 148 const intptr_t* round_; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 | 151 |
| 152 const intptr_t InterruptChecker::kTaskCount = 50; | 152 const intptr_t InterruptChecker::kTaskCount = 5; |
| 153 const intptr_t InterruptChecker::kIterations = 1000; | 153 const intptr_t InterruptChecker::kIterations = 10; |
| 154 | 154 |
| 155 | 155 |
| 156 // Waits for all tasks to set their individual flag, then clears them all. | 156 // Waits for all tasks to set their individual flag, then clears them all. |
| 157 static void WaitForAllTasks(bool* flags, Monitor* monitor) { | 157 static void WaitForAllTasks(bool* flags, Monitor* monitor) { |
| 158 MonitorLocker ml(monitor); | 158 MonitorLocker ml(monitor); |
| 159 while (true) { | 159 while (true) { |
| 160 intptr_t count = 0; | 160 intptr_t count = 0; |
| 161 for (intptr_t task = 0; task < InterruptChecker::kTaskCount; ++task) { | 161 for (intptr_t task = 0; task < InterruptChecker::kTaskCount; ++task) { |
| 162 if (flags[task]) { | 162 if (flags[task]) { |
| 163 ++count; | 163 ++count; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 MonitorLocker ml(&round_monitor); | 206 MonitorLocker ml(&round_monitor); |
| 207 ++round; | 207 ++round; |
| 208 ml.NotifyAll(); | 208 ml.NotifyAll(); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 // Wait for tasks to exit cleanly. | 211 // Wait for tasks to exit cleanly. |
| 212 WaitForAllTasks(awake, &awake_monitor); | 212 WaitForAllTasks(awake, &awake_monitor); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace dart | 215 } // namespace dart |
| OLD | NEW |