Mutex, CriticalSection: Switch Mac to _PTHREAD_MUTEX_POLICY_FIRSTFIT.

Fairshare mutexes performed really badly during a Catalina
performance test. This change switches them to use
the _PTHREAD_MUTEX_POLICY_FIRSTFIT policy instead.

Bug: webrtc:11567, webrtc:11648
Change-Id: I2b8fbe3183beefc26f8d4ff3d63dc6958174605f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176504
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31456}
This commit is contained in:
Markus Handell 2020-06-05 11:21:10 +02:00 committed by Commit Bot
parent 17f85b8415
commit 4a4f162f71
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ CriticalSection::CriticalSection() {
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
#if defined(WEBRTC_MAC)
pthread_mutexattr_setpolicy_np(&mutex_attribute,
_PTHREAD_MUTEX_POLICY_FAIRSHARE);
_PTHREAD_MUTEX_POLICY_FIRSTFIT);
#endif
pthread_mutex_init(&mutex_, &mutex_attribute);
pthread_mutexattr_destroy(&mutex_attribute);

View File

@ -29,7 +29,7 @@ class RTC_LOCKABLE MutexImpl final {
pthread_mutexattr_init(&mutex_attribute);
#if defined(WEBRTC_MAC)
pthread_mutexattr_setpolicy_np(&mutex_attribute,
_PTHREAD_MUTEX_POLICY_FAIRSHARE);
_PTHREAD_MUTEX_POLICY_FIRSTFIT);
#endif
pthread_mutex_init(&mutex_, &mutex_attribute);
pthread_mutexattr_destroy(&mutex_attribute);