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

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

Issue 156233002: Add support for threading and atomic ops in QNX Neutrino. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « base/atomicops_internals_arm_gcc.h ('k') | build/build_config.h » ('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) 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 <sched.h> 8 #include <sched.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // static 143 // static
144 PlatformThreadId PlatformThread::CurrentId() { 144 PlatformThreadId PlatformThread::CurrentId() {
145 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 145 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
146 // into the kernel. 146 // into the kernel.
147 #if defined(OS_MACOSX) 147 #if defined(OS_MACOSX)
148 return pthread_mach_thread_np(pthread_self()); 148 return pthread_mach_thread_np(pthread_self());
149 #elif defined(OS_LINUX) 149 #elif defined(OS_LINUX)
150 return syscall(__NR_gettid); 150 return syscall(__NR_gettid);
151 #elif defined(OS_ANDROID) 151 #elif defined(OS_ANDROID)
152 return gettid(); 152 return gettid();
153 #elif defined(OS_SOLARIS) 153 #elif defined(OS_SOLARIS) || defined(OS_QNX)
154 return pthread_self(); 154 return pthread_self();
155 #elif defined(OS_NACL) && defined(__GLIBC__) 155 #elif defined(OS_NACL) && defined(__GLIBC__)
156 return pthread_self(); 156 return pthread_self();
157 #elif defined(OS_NACL) && !defined(__GLIBC__) 157 #elif defined(OS_NACL) && !defined(__GLIBC__)
158 // Pointers are 32-bits in NaCl. 158 // Pointers are 32-bits in NaCl.
159 return reinterpret_cast<int32>(pthread_self()); 159 return reinterpret_cast<int32>(pthread_self());
160 #elif defined(OS_POSIX) 160 #elif defined(OS_POSIX)
161 return reinterpret_cast<int64>(pthread_self()); 161 return reinterpret_cast<int64>(pthread_self());
162 #endif 162 #endif
163 } 163 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // static 222 // static
223 void PlatformThread::Join(PlatformThreadHandle thread_handle) { 223 void PlatformThread::Join(PlatformThreadHandle thread_handle) {
224 // Joining another thread may block the current thread for a long time, since 224 // Joining another thread may block the current thread for a long time, since
225 // the thread referred to by |thread_handle| may still be running long-lived / 225 // the thread referred to by |thread_handle| may still be running long-lived /
226 // blocking tasks. 226 // blocking tasks.
227 base::ThreadRestrictions::AssertIOAllowed(); 227 base::ThreadRestrictions::AssertIOAllowed();
228 CHECK_EQ(0, pthread_join(thread_handle.handle_, NULL)); 228 CHECK_EQ(0, pthread_join(thread_handle.handle_, NULL));
229 } 229 }
230 230
231 } // namespace base 231 } // namespace base
OLDNEW
« no previous file with comments | « base/atomicops_internals_arm_gcc.h ('k') | build/build_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698