| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <sched.h> | 8 #include <sched.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 PlatformThreadId PlatformThread::CurrentId() { | 120 PlatformThreadId PlatformThread::CurrentId() { |
| 121 // Pthreads doesn't have the concept of a thread ID, so we have to reach down | 121 // Pthreads doesn't have the concept of a thread ID, so we have to reach down |
| 122 // into the kernel. | 122 // into the kernel. |
| 123 #if defined(OS_MACOSX) | 123 #if defined(OS_MACOSX) |
| 124 return mach_thread_self(); | 124 return mach_thread_self(); |
| 125 #elif defined(OS_LINUX) | 125 #elif defined(OS_LINUX) |
| 126 return syscall(__NR_gettid); | 126 return syscall(__NR_gettid); |
| 127 #elif defined(OS_FREEBSD) | 127 #elif defined(OS_FREEBSD) |
| 128 // TODO(BSD): find a better thread ID | 128 // TODO(BSD): find a better thread ID |
| 129 return reinterpret_cast<int64>(pthread_self()); | 129 return reinterpret_cast<int64>(pthread_self()); |
| 130 #elif defined(OS_NACL) | 130 #elif defined(OS_NACL) || defined(OS_SOLARIS) |
| 131 return pthread_self(); | 131 return pthread_self(); |
| 132 #endif | 132 #endif |
| 133 } | 133 } |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 void PlatformThread::YieldCurrentThread() { | 136 void PlatformThread::YieldCurrentThread() { |
| 137 sched_yield(); | 137 sched_yield(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // static | 140 // static |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Mac OS X uses lower-level mach APIs | 226 // Mac OS X uses lower-level mach APIs |
| 227 | 227 |
| 228 // static | 228 // static |
| 229 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) { | 229 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) { |
| 230 // TODO(crogers): implement | 230 // TODO(crogers): implement |
| 231 NOTIMPLEMENTED(); | 231 NOTIMPLEMENTED(); |
| 232 } | 232 } |
| 233 #endif | 233 #endif |
| 234 | 234 |
| 235 } // namespace base | 235 } // namespace base |
| OLD | NEW |