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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 | 253 |
254 | 254 |
255 int OS::GetCurrentThreadId() { | 255 int OS::GetCurrentThreadId() { |
256 #if V8_OS_MACOSX | 256 #if V8_OS_MACOSX |
257 return static_cast<int>(pthread_mach_thread_np(pthread_self())); | 257 return static_cast<int>(pthread_mach_thread_np(pthread_self())); |
258 #elif V8_OS_LINUX | 258 #elif V8_OS_LINUX |
259 return static_cast<int>(syscall(__NR_gettid)); | 259 return static_cast<int>(syscall(__NR_gettid)); |
260 #elif V8_OS_ANDROID | 260 #elif V8_OS_ANDROID |
261 return static_cast<int>(gettid()); | 261 return static_cast<int>(gettid()); |
262 #else | 262 #else |
263 return reinterpret_cast<int>(pthread_self()); | 263 return static_cast<int>(pthread_self()); |
Sven Panne
2014/10/15 08:54:51
Hmmm, this is still a bit wacky and will fail some
| |
264 #endif | 264 #endif |
265 } | 265 } |
266 | 266 |
267 | 267 |
268 // ---------------------------------------------------------------------------- | 268 // ---------------------------------------------------------------------------- |
269 // POSIX date/time support. | 269 // POSIX date/time support. |
270 // | 270 // |
271 | 271 |
272 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 272 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
273 #if V8_OS_NACL | 273 #if V8_OS_NACL |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 | 669 |
670 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 670 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
671 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 671 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
672 int result = pthread_setspecific(pthread_key, value); | 672 int result = pthread_setspecific(pthread_key, value); |
673 DCHECK_EQ(0, result); | 673 DCHECK_EQ(0, result); |
674 USE(result); | 674 USE(result); |
675 } | 675 } |
676 | 676 |
677 | 677 |
678 } } // namespace v8::base | 678 } } // namespace v8::base |
OLD | NEW |