Remove Mutex::ClearOwner.

This was a bad idea (of mine) badly implemented (by me). I went a different
and better route in Heap::Destroy, and that fix -- allowing us to destroy
a locked mutex during shutdown -- makes this code obsolete.

Change-Id: I79452a26b4cbf131b37bf9ca131e46500f1e5a5e
diff --git a/src/monitor.cc b/src/monitor.cc
index 662e199..a29f2a1 100644
--- a/src/monitor.cc
+++ b/src/monitor.cc
@@ -817,20 +817,6 @@
 
 MonitorList::~MonitorList() {
   MutexLock mu(lock_);
-
-  // In case there is a daemon thread with the monitor locked, clear
-  // the owner here so we can destroy the mutex, which will otherwise
-  // fail in pthread_mutex_destroy.
-  typedef std::list<Monitor*>::iterator It; // TODO: C++0x auto
-  for (It it = list_.begin(); it != list_.end(); it++) {
-      Monitor* monitor = *it;
-      Mutex& lock = monitor->lock_;
-      if (lock.GetOwner() != 0) {
-        DCHECK_EQ(lock.GetOwner(), monitor->owner_->GetTid());
-        lock.ClearOwner();
-      }
-  }
-
   STLDeleteElements(&list_);
 }
 
diff --git a/src/mutex.cc b/src/mutex.cc
index 8ff1207..5d207f6 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -88,25 +88,6 @@
 #endif
 }
 
-void Mutex::ClearOwner() {
-#if defined(__BIONIC__)
-#define  __PTHREAD_RECURSIVE_MUTEX_INIT_VALUE  0x4000
-  mutex_.value = __PTHREAD_RECURSIVE_MUTEX_INIT_VALUE;
-#elif defined(__GLIBC__)
-  struct __attribute__((__may_alias__)) glibc_pthread_t {
-    int lock;
-    unsigned int count;
-    int owner;
-    // ...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
-}
-
 uint32_t Mutex::GetDepth() {
   bool held = (GetOwner() == GetTid());
   if (!held) {
diff --git a/src/mutex.h b/src/mutex.h
index 93f6c3e..f4658fb4 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -68,15 +68,12 @@
  private:
   static pid_t GetTid();
 
-  void ClearOwner();
-
   uint32_t GetDepth();
 
   std::string name_;
 
   pthread_mutex_t mutex_;
 
-  friend class MonitorList;  // for ClearOwner
   DISALLOW_COPY_AND_ASSIGN(Mutex);
 };