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

Side by Side Diff: webrtc/base/platform_thread.cc

Issue 2732443002: Go back to only using sched_yield on Mac (sigh) (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 << ", " << id << " vs " << compare_id; 254 << ", " << id << " vs " << compare_id;
255 } 255 }
256 } 256 }
257 ++sequence_nr; 257 ++sequence_nr;
258 #endif 258 #endif
259 #if defined(WEBRTC_WIN) 259 #if defined(WEBRTC_WIN)
260 // Alertable sleep to permit RaiseFlag to run and update |stop_|. 260 // Alertable sleep to permit RaiseFlag to run and update |stop_|.
261 SleepEx(0, true); 261 SleepEx(0, true);
262 } while (!stop_); 262 } while (!stop_);
263 #else 263 #else
264 #if defined(UNDEFINED_SANITIZER) || defined(WEBRTC_ANDROID) 264 #if defined(WEBRTC_MAC)
265 // UBSAN and Android don't like |sched_yield()| that much. 265 sched_yield();
266 #else
266 static const struct timespec ts_null = {0}; 267 static const struct timespec ts_null = {0};
267 nanosleep(&ts_null, nullptr); 268 nanosleep(&ts_null, nullptr);
268 #else // !(defined(UNDEFINED_SANITIZER) || defined(WEBRTC_ANDROID))
269 // Mac and Linux show better performance with sched_yield.
270 sched_yield();
271 #endif 269 #endif
272 } while (!AtomicOps::AcquireLoad(&stop_flag_)); 270 } while (!AtomicOps::AcquireLoad(&stop_flag_));
273 #endif // defined(WEBRTC_WIN) 271 #endif // defined(WEBRTC_WIN)
274 } 272 }
275 273
276 bool PlatformThread::SetPriority(ThreadPriority priority) { 274 bool PlatformThread::SetPriority(ThreadPriority priority) {
277 #if RTC_DCHECK_IS_ON 275 #if RTC_DCHECK_IS_ON
278 if (run_function_) { 276 if (run_function_) {
279 // The non-deprecated way of how this function gets called, is that it must 277 // The non-deprecated way of how this function gets called, is that it must
280 // be called on the worker thread itself. 278 // be called on the worker thread itself.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #if defined(WEBRTC_WIN) 339 #if defined(WEBRTC_WIN)
342 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) { 340 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) {
343 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 341 RTC_DCHECK(thread_checker_.CalledOnValidThread());
344 RTC_DCHECK(IsRunning()); 342 RTC_DCHECK(IsRunning());
345 343
346 return QueueUserAPC(function, thread_, data) != FALSE; 344 return QueueUserAPC(function, thread_, data) != FALSE;
347 } 345 }
348 #endif 346 #endif
349 347
350 } // namespace rtc 348 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698