Bug 1350955 - Enable adaptive mutex usage on FreeBSD. r=froydnj
MozReview-Commit-ID: 7bfgK4TfZsH
--- 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