Bug 1350955 - Enable adaptive mutex usage on FreeBSD. r=froydnj draft
authorJan Beich <jbeich@FreeBSD.org>
Mon, 27 Mar 2017 15:14:00 +0000
changeset 551899 9c9df1b538982bf6fbb99db618c2188bc9ec8a87
parent 504632 4c987b7ed54a630a7de76adcc2eb00dab49d5dfd
child 621668 2b32ea03d3286b78abc66b3f7e3c74d5fa58003d
push id51188
push userbmo:jbeich@FreeBSD.org
push dateMon, 27 Mar 2017 16:34:02 +0000
reviewersfroydnj
bugs1350955
milestone55.0a1
Bug 1350955 - Enable adaptive mutex usage on FreeBSD. r=froydnj MozReview-Commit-ID: 7bfgK4TfZsH
mozglue/misc/Mutex_posix.cpp
--- a/mozglue/misc/Mutex_posix.cpp
+++ b/mozglue/misc/Mutex_posix.cpp
@@ -22,19 +22,20 @@
       MOZ_CRASH(msg);                           \
     }                                           \
   }
 
 mozilla::detail::MutexImpl::MutexImpl()
 {
   pthread_mutexattr_t* attrp = nullptr;
 
-  // glibc's adaptive mutexes spin for a short number of tries before sleeping.
-  // NSPR's locks did this, too, and it seems like a reasonable thing to do.
-#if defined(__linux__) && defined(__GLIBC__)
+  // Linux with glibc and FreeBSD support adaptive mutexes that spin
+  // for a short number of tries before sleeping.  NSPR's locks did
+  // this, too, and it seems like a reasonable thing to do.
+#if (defined(__linux__) && defined(__GLIBC__)) || defined(__FreeBSD__)
 #define ADAPTIVE_MUTEX_SUPPORTED
 #endif
 
 #if defined(DEBUG)
 #define ATTR_REQUIRED
 #define MUTEX_KIND PTHREAD_MUTEX_ERRORCHECK
 #elif defined(ADAPTIVE_MUTEX_SUPPORTED)
 #define ATTR_REQUIRED