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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return sysconf(_SC_NPROCESSORS_ONLN); | 97 return sysconf(_SC_NPROCESSORS_ONLN); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 void OS::Sleep(int64_t millis) { | 101 void OS::Sleep(int64_t millis) { |
102 // TODO(5411554): For now just use usleep we may have to revisit this. | 102 // TODO(5411554): For now just use usleep we may have to revisit this. |
103 usleep(millis * 1000); | 103 usleep(millis * 1000); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 void OS::DebugBreak() { | |
108 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32) | |
109 asm("int $3"); | |
110 #else | |
111 #error Unsupported architecture. | |
112 #endif | |
113 } | |
114 | |
115 | |
116 void OS::Print(const char* format, ...) { | 107 void OS::Print(const char* format, ...) { |
117 va_list args; | 108 va_list args; |
118 va_start(args, format); | 109 va_start(args, format); |
119 VFPrint(stdout, format, args); | 110 VFPrint(stdout, format, args); |
120 va_end(args); | 111 va_end(args); |
121 } | 112 } |
122 | 113 |
123 | 114 |
124 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 115 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
125 vfprintf(stream, format, args); | 116 vfprintf(stream, format, args); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void OS::Abort() { | 157 void OS::Abort() { |
167 abort(); | 158 abort(); |
168 } | 159 } |
169 | 160 |
170 | 161 |
171 void OS::Exit(int code) { | 162 void OS::Exit(int code) { |
172 exit(code); | 163 exit(code); |
173 } | 164 } |
174 | 165 |
175 } // namespace dart | 166 } // namespace dart |
OLD | NEW |