| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 #include "base/threading/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <pthread.h> | 8 #include <pthread.h> |
| 9 #include <sched.h> | 9 #include <sched.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // static | 130 // static |
| 131 PlatformThreadId PlatformThread::CurrentId() { | 131 PlatformThreadId PlatformThread::CurrentId() { |
| 132 // Pthreads doesn't have the concept of a thread ID, so we have to reach down | 132 // Pthreads doesn't have the concept of a thread ID, so we have to reach down |
| 133 // into the kernel. | 133 // into the kernel. |
| 134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
| 135 return pthread_mach_thread_np(pthread_self()); | 135 return pthread_mach_thread_np(pthread_self()); |
| 136 #elif defined(OS_LINUX) | 136 #elif defined(OS_LINUX) |
| 137 return syscall(__NR_gettid); | 137 return syscall(__NR_gettid); |
| 138 #elif defined(OS_ANDROID) | 138 #elif defined(OS_ANDROID) |
| 139 return gettid(); | 139 return gettid(); |
| 140 #elif defined(OS_SOLARIS) || defined(OS_QNX) | 140 #elif defined(OS_SOLARIS) || defined(OS_QNX) || defined(OS_FUCHSIA) |
| 141 return pthread_self(); | 141 return pthread_self(); |
| 142 #elif defined(OS_NACL) && defined(__GLIBC__) | 142 #elif defined(OS_NACL) && defined(__GLIBC__) |
| 143 return pthread_self(); | 143 return pthread_self(); |
| 144 #elif defined(OS_NACL) && !defined(__GLIBC__) | 144 #elif defined(OS_NACL) && !defined(__GLIBC__) |
| 145 // Pointers are 32-bits in NaCl. | 145 // Pointers are 32-bits in NaCl. |
| 146 return reinterpret_cast<int32_t>(pthread_self()); | 146 return reinterpret_cast<int32_t>(pthread_self()); |
| 147 #elif defined(OS_POSIX) && defined(OS_AIX) | 147 #elif defined(OS_POSIX) && defined(OS_AIX) |
| 148 return pthread_self(); | 148 return pthread_self(); |
| 149 #elif defined(OS_POSIX) && !defined(OS_AIX) | 149 #elif defined(OS_POSIX) && !defined(OS_AIX) |
| 150 return reinterpret_cast<int64_t>(pthread_self()); | 150 return reinterpret_cast<int64_t>(pthread_self()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return ThreadPriority::NORMAL; | 288 return ThreadPriority::NORMAL; |
| 289 } | 289 } |
| 290 | 290 |
| 291 return internal::NiceValueToThreadPriority(nice_value); | 291 return internal::NiceValueToThreadPriority(nice_value); |
| 292 #endif // !defined(OS_NACL) | 292 #endif // !defined(OS_NACL) |
| 293 } | 293 } |
| 294 | 294 |
| 295 #endif // !defined(OS_MACOSX) | 295 #endif // !defined(OS_MACOSX) |
| 296 | 296 |
| 297 } // namespace base | 297 } // namespace base |
| OLD | NEW |