| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 int OS::GetCurrentThreadId() { | 267 int OS::GetCurrentThreadId() { |
| 268 #if V8_OS_MACOSX || (V8_OS_ANDROID && defined(__APPLE__)) | 268 #if V8_OS_MACOSX || (V8_OS_ANDROID && defined(__APPLE__)) |
| 269 return static_cast<int>(pthread_mach_thread_np(pthread_self())); | 269 return static_cast<int>(pthread_mach_thread_np(pthread_self())); |
| 270 #elif V8_OS_LINUX | 270 #elif V8_OS_LINUX |
| 271 return static_cast<int>(syscall(__NR_gettid)); | 271 return static_cast<int>(syscall(__NR_gettid)); |
| 272 #elif V8_OS_ANDROID | 272 #elif V8_OS_ANDROID |
| 273 return static_cast<int>(gettid()); | 273 return static_cast<int>(gettid()); |
| 274 #elif V8_OS_AIX | 274 #elif V8_OS_AIX |
| 275 return static_cast<int>(thread_self()); | 275 return static_cast<int>(thread_self()); |
| 276 #elif V8_OS_SOLARIS |
| 277 return static_cast<int>(pthread_self()); |
| 276 #else | 278 #else |
| 277 return static_cast<int>(reinterpret_cast<intptr_t>(pthread_self())); | 279 return static_cast<int>(reinterpret_cast<intptr_t>(pthread_self())); |
| 278 #endif | 280 #endif |
| 279 } | 281 } |
| 280 | 282 |
| 281 | 283 |
| 282 // ---------------------------------------------------------------------------- | 284 // ---------------------------------------------------------------------------- |
| 283 // POSIX date/time support. | 285 // POSIX date/time support. |
| 284 // | 286 // |
| 285 | 287 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 692 |
| 691 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 693 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 692 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 694 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 693 int result = pthread_setspecific(pthread_key, value); | 695 int result = pthread_setspecific(pthread_key, value); |
| 694 DCHECK_EQ(0, result); | 696 DCHECK_EQ(0, result); |
| 695 USE(result); | 697 USE(result); |
| 696 } | 698 } |
| 697 | 699 |
| 698 | 700 |
| 699 } } // namespace v8::base | 701 } } // namespace v8::base |
| OLD | NEW |