Work around the lack of gettid(3) on Mac OS.
This just disables the checks that need a tid.
Change-Id: I5fb39db9e36f896cbfa55dffb974677dc0f033e2
diff --git a/src/mutex.cc b/src/mutex.cc
index d41c6cb..fca31b6 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -76,6 +76,9 @@
// ...other stuff we don't care about.
};
return reinterpret_cast<glibc_pthread_t*>(&mutex_)->owner;
+#elif defined(__APPLE__)
+ // We don't know a way to implement this for Mac OS.
+ return 0;
#else
UNIMPLEMENTED(FATAL);
return 0;
@@ -93,6 +96,8 @@
// ...other stuff we don't care about.
};
reinterpret_cast<glibc_pthread_t*>(&mutex_)->owner = 0;
+#elif defined(__APPLE__)
+ // We don't know a way to implement this for Mac OS.
#else
UNIMPLEMENTED(FATAL);
#endif
diff --git a/src/mutex.h b/src/mutex.h
index f22c5dc..949d221 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -45,11 +45,15 @@
}
void AssertHeld() {
+#if !defined(__APPLE__)
DCHECK_EQ(GetOwner(), GetTid());
+#endif
}
void AssertNotHeld() {
+#if !defined(__APPLE__)
DCHECK_NE(GetOwner(), GetTid());
+#endif
}
pid_t GetOwner();