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 | |
jochen (gone - plz use gerrit)
2015/03/09 16:09:11
can you merge this with the previous block, i.e.,
| |
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 | 697 |
696 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 698 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
697 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 699 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
698 int result = pthread_setspecific(pthread_key, value); | 700 int result = pthread_setspecific(pthread_key, value); |
699 DCHECK_EQ(0, result); | 701 DCHECK_EQ(0, result); |
700 USE(result); | 702 USE(result); |
701 } | 703 } |
702 | 704 |
703 | 705 |
704 } } // namespace v8::base | 706 } } // namespace v8::base |
OLD | NEW |