| 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 "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/vtune.h" | 9 #include "vm/vtune.h" |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 GetSystemInfo(&info); | 167 GetSystemInfo(&info); |
| 168 return info.dwNumberOfProcessors; | 168 return info.dwNumberOfProcessors; |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 void OS::Sleep(int64_t millis) { | 172 void OS::Sleep(int64_t millis) { |
| 173 ::Sleep(millis); | 173 ::Sleep(millis); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 void OS::SleepMicros(int64_t micros) { |
| 178 // Windows only supports millisecond sleeps. |
| 179 if (micros < kMicrosecondsPerMillisecond) { |
| 180 // Calling ::Sleep with 0 has no determined behaviour, round up. |
| 181 micros = kMicrosecondsPerMillisecond; |
| 182 } |
| 183 OS::Sleep(micros / kMicrosecondsPerMillisecond); |
| 184 } |
| 185 |
| 186 |
| 177 void OS::DebugBreak() { | 187 void OS::DebugBreak() { |
| 178 #if defined(_MSC_VER) | 188 #if defined(_MSC_VER) |
| 179 // Microsoft Visual C/C++ or drop-in replacement. | 189 // Microsoft Visual C/C++ or drop-in replacement. |
| 180 __debugbreak(); | 190 __debugbreak(); |
| 181 #elif defined(__GCC__) | 191 #elif defined(__GCC__) |
| 182 // MinGW? | 192 // MinGW? |
| 183 asm("int $3"); | 193 asm("int $3"); |
| 184 #else | 194 #else |
| 185 // Microsoft style assembly. | 195 // Microsoft style assembly. |
| 186 __asm { | 196 __asm { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 334 } |
| 325 | 335 |
| 326 | 336 |
| 327 void OS::Exit(int code) { | 337 void OS::Exit(int code) { |
| 328 exit(code); | 338 exit(code); |
| 329 } | 339 } |
| 330 | 340 |
| 331 } // namespace dart | 341 } // namespace dart |
| 332 | 342 |
| 333 #endif // defined(TARGET_OS_WINDOWS) | 343 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |