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

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

Issue 2033243002: Introduce PlatformThread::Detach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback Created 4 years, 6 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/threading/platform_thread.h ('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) 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 // static 203 // static
204 void PlatformThread::Join(PlatformThreadHandle thread_handle) { 204 void PlatformThread::Join(PlatformThreadHandle thread_handle) {
205 // Joining another thread may block the current thread for a long time, since 205 // Joining another thread may block the current thread for a long time, since
206 // the thread referred to by |thread_handle| may still be running long-lived / 206 // the thread referred to by |thread_handle| may still be running long-lived /
207 // blocking tasks. 207 // blocking tasks.
208 base::ThreadRestrictions::AssertIOAllowed(); 208 base::ThreadRestrictions::AssertIOAllowed();
209 CHECK_EQ(0, pthread_join(thread_handle.platform_handle(), NULL)); 209 CHECK_EQ(0, pthread_join(thread_handle.platform_handle(), NULL));
210 } 210 }
211 211
212 // static
213 void PlatformThread::Detach(PlatformThreadHandle thread_handle) {
214 CHECK_EQ(0, pthread_detach(thread_handle.platform_handle()));
215 }
216
212 // Mac has its own Set/GetCurrentThreadPriority() implementations. 217 // Mac has its own Set/GetCurrentThreadPriority() implementations.
213 #if !defined(OS_MACOSX) 218 #if !defined(OS_MACOSX)
214 219
215 // static 220 // static
216 void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) { 221 void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) {
217 #if defined(OS_NACL) 222 #if defined(OS_NACL)
218 NOTIMPLEMENTED(); 223 NOTIMPLEMENTED();
219 #else 224 #else
220 if (internal::SetCurrentThreadPriorityForPlatform(priority)) 225 if (internal::SetCurrentThreadPriorityForPlatform(priority))
221 return; 226 return;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return ThreadPriority::NORMAL; 262 return ThreadPriority::NORMAL;
258 } 263 }
259 264
260 return internal::NiceValueToThreadPriority(nice_value); 265 return internal::NiceValueToThreadPriority(nice_value);
261 #endif // !defined(OS_NACL) 266 #endif // !defined(OS_NACL)
262 } 267 }
263 268
264 #endif // !defined(OS_MACOSX) 269 #endif // !defined(OS_MACOSX)
265 270
266 } // namespace base 271 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread.h ('k') | base/threading/platform_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698