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

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

Issue 2692273008: Hacky slashy (Closed)
Patch Set: fixes Created 3 years, 10 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
OLDNEW
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
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) 147 #elif defined(OS_POSIX)
148 return reinterpret_cast<int64_t>(pthread_self()); 148 return reinterpret_cast<int64_t>(pthread_self());
149 #endif 149 #endif
150 } 150 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return ThreadPriority::NORMAL; 286 return ThreadPriority::NORMAL;
287 } 287 }
288 288
289 return internal::NiceValueToThreadPriority(nice_value); 289 return internal::NiceValueToThreadPriority(nice_value);
290 #endif // !defined(OS_NACL) 290 #endif // !defined(OS_NACL)
291 } 291 }
292 292
293 #endif // !defined(OS_MACOSX) 293 #endif // !defined(OS_MACOSX)
294 294
295 } // namespace base 295 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698