Rename USE_NATIVE_MUTEX_ON_MAC to RTC_USE_NATIVE_MUTEX_ON_MAC.
WebRTC internal macros should be prefixed by RTC_.
Bug: None
Change-Id: I1a0be41ca1ea35173edf34bc190fc425c5f2c67b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144782
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28509}
diff --git a/rtc_base/critical_section.cc b/rtc_base/critical_section.cc
index 4a5c53b..9e3615e 100644
--- a/rtc_base/critical_section.cc
+++ b/rtc_base/critical_section.cc
@@ -31,7 +31,7 @@
#if defined(WEBRTC_WIN)
InitializeCriticalSection(&crit_);
#elif defined(WEBRTC_POSIX)
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
lock_queue_ = 0;
owning_thread_ = 0;
recursion_ = 0;
@@ -60,7 +60,7 @@
#if defined(WEBRTC_WIN)
DeleteCriticalSection(&crit_);
#elif defined(WEBRTC_POSIX)
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
dispatch_release(semaphore_);
#else
pthread_mutex_destroy(&mutex_);
@@ -74,7 +74,7 @@
#if defined(WEBRTC_WIN)
EnterCriticalSection(&crit_);
#elif defined(WEBRTC_POSIX)
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
int spin = 3000;
PlatformThreadRef self = CurrentThreadRef();
bool have_lock = false;
@@ -133,7 +133,7 @@
#if defined(WEBRTC_WIN)
return TryEnterCriticalSection(&crit_) != FALSE;
#elif defined(WEBRTC_POSIX)
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
if (!IsThreadRefEqual(owning_thread_, CurrentThreadRef())) {
if (AtomicOps::CompareAndSwap(&lock_queue_, 0, 1) != 0)
return false;
@@ -173,7 +173,7 @@
if (!recursion_count_)
thread_ = 0;
#endif
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
RTC_DCHECK(IsThreadRefEqual(owning_thread_, CurrentThreadRef()));
RTC_DCHECK_GE(recursion_, 0);
--recursion_;
@@ -217,14 +217,15 @@
}
void GlobalLockPod::Lock() {
-#if !defined(WEBRTC_WIN) && (!defined(WEBRTC_MAC) || USE_NATIVE_MUTEX_ON_MAC)
+#if !defined(WEBRTC_WIN) && \
+ (!defined(WEBRTC_MAC) || RTC_USE_NATIVE_MUTEX_ON_MAC)
const struct timespec ts_null = {0};
#endif
while (AtomicOps::CompareAndSwap(&lock_acquired, 0, 1)) {
#if defined(WEBRTC_WIN)
::Sleep(0);
-#elif defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#elif defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
sched_yield();
#else
nanosleep(&ts_null, nullptr);
diff --git a/rtc_base/critical_section.h b/rtc_base/critical_section.h
index 4433529..f9047a6 100644
--- a/rtc_base/critical_section.h
+++ b/rtc_base/critical_section.h
@@ -34,9 +34,9 @@
#endif
// See notes in the 'Performance' unit test for the effects of this flag.
-#define USE_NATIVE_MUTEX_ON_MAC 1
+#define RTC_USE_NATIVE_MUTEX_ON_MAC 1
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
#include <dispatch/dispatch.h>
#endif
@@ -61,7 +61,7 @@
#if defined(WEBRTC_WIN)
mutable CRITICAL_SECTION crit_;
#elif defined(WEBRTC_POSIX)
-#if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
+#if defined(WEBRTC_MAC) && !RTC_USE_NATIVE_MUTEX_ON_MAC
// Number of times the lock has been locked + number of threads waiting.
// TODO(tommi): We could use this number and subtract the recursion count
// to find places where we have multiple threads contending on the same lock.