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

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

Issue 2790473006: Replace IOAllowed with WaitAllowed in PlatformThread::Join()
Patch Set: allow in IOThreadPreCleanup() Created 3 years, 8 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 | base/threading/platform_thread_win.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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ThreadPriority priority) { 204 ThreadPriority priority) {
205 PlatformThreadHandle unused; 205 PlatformThreadHandle unused;
206 206
207 bool result = CreateThread(stack_size, false /* non-joinable thread */, 207 bool result = CreateThread(stack_size, false /* non-joinable thread */,
208 delegate, &unused, priority); 208 delegate, &unused, priority);
209 return result; 209 return result;
210 } 210 }
211 211
212 // static 212 // static
213 void PlatformThread::Join(PlatformThreadHandle thread_handle) { 213 void PlatformThread::Join(PlatformThreadHandle thread_handle) {
214 // Joining another thread may block the current thread for a long time, since
215 // the thread referred to by |thread_handle| may still be running long-lived /
216 // blocking tasks.
217 base::ThreadRestrictions::AssertWaitAllowed();
218
214 // Record the event that this thread is blocking upon (for hang diagnosis). 219 // Record the event that this thread is blocking upon (for hang diagnosis).
215 base::debug::ScopedThreadJoinActivity thread_activity(&thread_handle); 220 base::debug::ScopedThreadJoinActivity thread_activity(&thread_handle);
216 221
217 // Joining another thread may block the current thread for a long time, since
218 // the thread referred to by |thread_handle| may still be running long-lived /
219 // blocking tasks.
220 base::ThreadRestrictions::AssertIOAllowed();
221 CHECK_EQ(0, pthread_join(thread_handle.platform_handle(), NULL)); 222 CHECK_EQ(0, pthread_join(thread_handle.platform_handle(), NULL));
222 } 223 }
223 224
224 // static 225 // static
225 void PlatformThread::Detach(PlatformThreadHandle thread_handle) { 226 void PlatformThread::Detach(PlatformThreadHandle thread_handle) {
226 CHECK_EQ(0, pthread_detach(thread_handle.platform_handle())); 227 CHECK_EQ(0, pthread_detach(thread_handle.platform_handle()));
227 } 228 }
228 229
229 // Mac has its own Set/GetCurrentThreadPriority() implementations. 230 // Mac has its own Set/GetCurrentThreadPriority() implementations.
230 #if !defined(OS_MACOSX) 231 #if !defined(OS_MACOSX)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return ThreadPriority::NORMAL; 287 return ThreadPriority::NORMAL;
287 } 288 }
288 289
289 return internal::NiceValueToThreadPriority(nice_value); 290 return internal::NiceValueToThreadPriority(nice_value);
290 #endif // !defined(OS_NACL) 291 #endif // !defined(OS_NACL)
291 } 292 }
292 293
293 #endif // !defined(OS_MACOSX) 294 #endif // !defined(OS_MACOSX)
294 295
295 } // namespace base 296 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698