| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 | 255 |
| 256 int OS::GetCurrentThreadId() { | 256 int OS::GetCurrentThreadId() { |
| 257 #if V8_OS_MACOSX || (V8_OS_ANDROID && defined(__APPLE__)) | 257 #if V8_OS_MACOSX || (V8_OS_ANDROID && defined(__APPLE__)) |
| 258 return static_cast<int>(pthread_mach_thread_np(pthread_self())); | 258 return static_cast<int>(pthread_mach_thread_np(pthread_self())); |
| 259 #elif V8_OS_LINUX | 259 #elif V8_OS_LINUX |
| 260 return static_cast<int>(syscall(__NR_gettid)); | 260 return static_cast<int>(syscall(__NR_gettid)); |
| 261 #elif V8_OS_ANDROID | 261 #elif V8_OS_ANDROID |
| 262 return static_cast<int>(gettid()); | 262 return static_cast<int>(gettid()); |
| 263 #else | 263 #else |
| 264 return static_cast<int>(pthread_self()); | 264 return static_cast<int>(reinterpret_cast<intptr_t>(pthread_self())); |
| 265 #endif | 265 #endif |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 // ---------------------------------------------------------------------------- | 269 // ---------------------------------------------------------------------------- |
| 270 // POSIX date/time support. | 270 // POSIX date/time support. |
| 271 // | 271 // |
| 272 | 272 |
| 273 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 273 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
| 274 #if V8_OS_NACL | 274 #if V8_OS_NACL |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 670 |
| 671 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 671 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 672 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 672 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 673 int result = pthread_setspecific(pthread_key, value); | 673 int result = pthread_setspecific(pthread_key, value); |
| 674 DCHECK_EQ(0, result); | 674 DCHECK_EQ(0, result); |
| 675 USE(result); | 675 USE(result); |
| 676 } | 676 } |
| 677 | 677 |
| 678 | 678 |
| 679 } } // namespace v8::base | 679 } } // namespace v8::base |
| OLD | NEW |