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

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

Issue 9178025: Merge 117127 - mach_port_deallocate() the result of mach_thread_self(), which obtains a port send... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/logging.cc ('k') | base/threading/platform_thread_unittest.cc » ('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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return success; 127 return success;
128 } 128 }
129 129
130 } // namespace 130 } // namespace
131 131
132 // static 132 // static
133 PlatformThreadId PlatformThread::CurrentId() { 133 PlatformThreadId PlatformThread::CurrentId() {
134 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 134 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
135 // into the kernel. 135 // into the kernel.
136 #if defined(OS_MACOSX) 136 #if defined(OS_MACOSX)
137 return mach_thread_self(); 137 mach_port_t port = mach_thread_self();
138 mach_port_deallocate(mach_task_self(), port);
139 return port;
138 #elif defined(OS_LINUX) 140 #elif defined(OS_LINUX)
139 return syscall(__NR_gettid); 141 return syscall(__NR_gettid);
140 #elif defined(OS_ANDROID) 142 #elif defined(OS_ANDROID)
141 return gettid(); 143 return gettid();
142 #elif defined(OS_NACL) || defined(OS_SOLARIS) 144 #elif defined(OS_NACL) || defined(OS_SOLARIS)
143 return pthread_self(); 145 return pthread_self();
144 #elif defined(OS_POSIX) 146 #elif defined(OS_POSIX)
145 return reinterpret_cast<int64>(pthread_self()); 147 return reinterpret_cast<int64>(pthread_self());
146 #endif 148 #endif
147 } 149 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Mac OS X uses lower-level mach APIs 259 // Mac OS X uses lower-level mach APIs
258 260
259 // static 261 // static
260 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) { 262 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) {
261 // TODO(crogers): implement 263 // TODO(crogers): implement
262 NOTIMPLEMENTED(); 264 NOTIMPLEMENTED();
263 } 265 }
264 #endif 266 #endif
265 267
266 } // namespace base 268 } // namespace base
OLDNEW
« no previous file with comments | « base/logging.cc ('k') | base/threading/platform_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698