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

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

Issue 292873002: make debug mode ~20% faster on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: odd dcheck removed Created 6 years, 7 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 | « no previous file | content/common/set_process_title.cc » ('j') | content/common/set_process_title.cc » ('J')
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 } // namespace 143 } // namespace
144 144
145 // static 145 // static
146 PlatformThreadId PlatformThread::CurrentId() { 146 PlatformThreadId PlatformThread::CurrentId() {
147 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 147 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
148 // into the kernel. 148 // into the kernel.
149 #if defined(OS_MACOSX) 149 #if defined(OS_MACOSX)
150 return pthread_mach_thread_np(pthread_self()); 150 return pthread_mach_thread_np(pthread_self());
151 #elif defined(OS_LINUX) 151 #elif defined(OS_LINUX)
152 return syscall(__NR_gettid); 152 return pthread_self();
piman 2014/05/20 05:09:22 On my system, PlatformThreadId (a pid_t currently)
153 #elif defined(OS_ANDROID) 153 #elif defined(OS_ANDROID)
154 return gettid(); 154 return gettid();
155 #elif defined(OS_SOLARIS) || defined(OS_QNX) 155 #elif defined(OS_SOLARIS) || defined(OS_QNX)
156 return pthread_self(); 156 return pthread_self();
157 #elif defined(OS_NACL) && defined(__GLIBC__) 157 #elif defined(OS_NACL) && defined(__GLIBC__)
158 return pthread_self(); 158 return pthread_self();
159 #elif defined(OS_NACL) && !defined(__GLIBC__) 159 #elif defined(OS_NACL) && !defined(__GLIBC__)
160 // Pointers are 32-bits in NaCl. 160 // Pointers are 32-bits in NaCl.
161 return reinterpret_cast<int32>(pthread_self()); 161 return reinterpret_cast<int32>(pthread_self());
162 #elif defined(OS_POSIX) 162 #elif defined(OS_POSIX)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // static 224 // static
225 void PlatformThread::Join(PlatformThreadHandle thread_handle) { 225 void PlatformThread::Join(PlatformThreadHandle thread_handle) {
226 // Joining another thread may block the current thread for a long time, since 226 // Joining another thread may block the current thread for a long time, since
227 // the thread referred to by |thread_handle| may still be running long-lived / 227 // the thread referred to by |thread_handle| may still be running long-lived /
228 // blocking tasks. 228 // blocking tasks.
229 base::ThreadRestrictions::AssertIOAllowed(); 229 base::ThreadRestrictions::AssertIOAllowed();
230 CHECK_EQ(0, pthread_join(thread_handle.handle_, NULL)); 230 CHECK_EQ(0, pthread_join(thread_handle.handle_, NULL));
231 } 231 }
232 232
233 } // namespace base 233 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | content/common/set_process_title.cc » ('j') | content/common/set_process_title.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698