Comment on use of 0 and -1 values in mutex implementation
Change-Id: I4834feb2aa78962086c39c1512483964a3a2a52a
diff --git a/src/mutex.cc b/src/mutex.cc
index eef8bdc..2811843 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -278,6 +278,8 @@
#elif defined(__APPLE__)
const darwin_pthread_mutex_t* dpmutex = reinterpret_cast<const darwin_pthread_mutex_t*>(&mutex_);
pthread_t owner = dpmutex->darwin_pthread_mutex_owner;
+ // 0 for unowned, -1 for PTHREAD_MTX_TID_SWITCHING
+ // TODO: should we make darwin_pthread_mutex_owner volatile and recheck until not -1?
if ((owner == (pthread_t)0) || (owner == (pthread_t)-1)) {
return 0;
}