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/os.h" | 5 #include "vm/os.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <mach/mach.h> | 9 #include <mach/mach.h> |
10 #include <mach/clock.h> | 10 #include <mach/clock.h> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return sysconf(_SC_NPROCESSORS_ONLN); | 116 return sysconf(_SC_NPROCESSORS_ONLN); |
117 } | 117 } |
118 | 118 |
119 | 119 |
120 void OS::Sleep(int64_t millis) { | 120 void OS::Sleep(int64_t millis) { |
121 // TODO(5411554): For now just use usleep we may have to revisit this. | 121 // TODO(5411554): For now just use usleep we may have to revisit this. |
122 usleep(millis * 1000); | 122 usleep(millis * 1000); |
123 } | 123 } |
124 | 124 |
125 | 125 |
| 126 void OS::DebugBreak() { |
| 127 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32) |
| 128 asm("int $3"); |
| 129 #else |
| 130 #error Unsupported architecture. |
| 131 #endif |
| 132 } |
| 133 |
| 134 |
126 void OS::Print(const char* format, ...) { | 135 void OS::Print(const char* format, ...) { |
127 va_list args; | 136 va_list args; |
128 va_start(args, format); | 137 va_start(args, format); |
129 VFPrint(stdout, format, args); | 138 VFPrint(stdout, format, args); |
130 va_end(args); | 139 va_end(args); |
131 } | 140 } |
132 | 141 |
133 | 142 |
134 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 143 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
135 vfprintf(stream, format, args); | 144 vfprintf(stream, format, args); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void OS::Abort() { | 212 void OS::Abort() { |
204 abort(); | 213 abort(); |
205 } | 214 } |
206 | 215 |
207 | 216 |
208 void OS::Exit(int code) { | 217 void OS::Exit(int code) { |
209 exit(code); | 218 exit(code); |
210 } | 219 } |
211 | 220 |
212 } // namespace dart | 221 } // namespace dart |
OLD | NEW |