Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: base/threading/platform_thread_posix.cc

Issue 8228005: openbsd and freebsd fixes for base (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add myself to the AUTHORS Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/sys_info_openbsd.cc ('k') | build/common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // static 125 // static
126 PlatformThreadId PlatformThread::CurrentId() { 126 PlatformThreadId PlatformThread::CurrentId() {
127 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 127 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
128 // into the kernel. 128 // into the kernel.
129 #if defined(OS_MACOSX) 129 #if defined(OS_MACOSX)
130 return mach_thread_self(); 130 return mach_thread_self();
131 #elif defined(OS_LINUX) 131 #elif defined(OS_LINUX)
132 return syscall(__NR_gettid); 132 return syscall(__NR_gettid);
133 #elif defined(OS_ANDROID) 133 #elif defined(OS_ANDROID)
134 return gettid(); 134 return gettid();
135 #elif defined(OS_FREEBSD)
136 // TODO(BSD): find a better thread ID
137 return reinterpret_cast<int64>(pthread_self());
138 #elif defined(OS_NACL) || defined(OS_SOLARIS) 135 #elif defined(OS_NACL) || defined(OS_SOLARIS)
139 return pthread_self(); 136 return pthread_self();
137 #elif defined(OS_POSIX)
138 return reinterpret_cast<int64>(pthread_self());
140 #endif 139 #endif
141 } 140 }
142 141
143 // static 142 // static
144 void PlatformThread::YieldCurrentThread() { 143 void PlatformThread::YieldCurrentThread() {
145 sched_yield(); 144 sched_yield();
146 } 145 }
147 146
148 // static 147 // static
149 void PlatformThread::Sleep(int duration_ms) { 148 void PlatformThread::Sleep(int duration_ms) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Mac OS X uses lower-level mach APIs 248 // Mac OS X uses lower-level mach APIs
250 249
251 // static 250 // static
252 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) { 251 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) {
253 // TODO(crogers): implement 252 // TODO(crogers): implement
254 NOTIMPLEMENTED(); 253 NOTIMPLEMENTED();
255 } 254 }
256 #endif 255 #endif
257 256
258 } // namespace base 257 } // namespace base
OLDNEW
« no previous file with comments | « base/sys_info_openbsd.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698