| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Platform-specific code for POSIX goes here. This is not a platform on its | 5 // Platform-specific code for POSIX goes here. This is not a platform on its |
| 6 // own, but contains the parts which are the same across the POSIX platforms | 6 // own, but contains the parts which are the same across the POSIX platforms |
| 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. | 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <limits.h> | 10 #include <limits.h> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 #endif | 212 #endif |
| 213 return reinterpret_cast<void*>(raw_addr); | 213 return reinterpret_cast<void*>(raw_addr); |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 size_t OS::AllocateAlignment() { | 217 size_t OS::AllocateAlignment() { |
| 218 return static_cast<size_t>(sysconf(_SC_PAGESIZE)); | 218 return static_cast<size_t>(sysconf(_SC_PAGESIZE)); |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 void OS::Sleep(int milliseconds) { | 222 void OS::Sleep(TimeDelta interval) { |
| 223 useconds_t ms = static_cast<useconds_t>(milliseconds); | 223 usleep(static_cast<useconds_t>(interval.InMicroseconds())); |
| 224 usleep(1000 * ms); | |
| 225 } | 224 } |
| 226 | 225 |
| 227 | 226 |
| 228 void OS::Abort() { | 227 void OS::Abort() { |
| 229 if (g_hard_abort) { | 228 if (g_hard_abort) { |
| 230 V8_IMMEDIATE_CRASH(); | 229 V8_IMMEDIATE_CRASH(); |
| 231 } | 230 } |
| 232 // Redirect to std abort to signal abnormal program termination. | 231 // Redirect to std abort to signal abnormal program termination. |
| 233 abort(); | 232 abort(); |
| 234 } | 233 } |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 748 |
| 750 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 749 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 751 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 750 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 752 int result = pthread_setspecific(pthread_key, value); | 751 int result = pthread_setspecific(pthread_key, value); |
| 753 DCHECK_EQ(0, result); | 752 DCHECK_EQ(0, result); |
| 754 USE(result); | 753 USE(result); |
| 755 } | 754 } |
| 756 | 755 |
| 757 } // namespace base | 756 } // namespace base |
| 758 } // namespace v8 | 757 } // namespace v8 |
| OLD | NEW |