Fix thread hang

- Primary problem was ScopedThreadListLock was releasing heap lock in constructor instead of destructor
- Secondary problem was ScopedThreadListLock should not be used with Mutex::Wait
- Added Thread.getStackTrace case to ThreadStress that reproduces YouTube problem
- Added Mutex::GetDepth and related methods that were useful in diagnoising this issue

Change-Id: I1bdc7245e9b411378b98f4dcf498ad66eb96366d
diff --git a/src/mutex.h b/src/mutex.h
index 949d221..93f6c3e 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -18,6 +18,7 @@
 #define ART_SRC_MUTEX_H_
 
 #include <pthread.h>
+#include <stdint.h>
 #include <string>
 
 #include "logging.h"
@@ -58,11 +59,19 @@
 
   pid_t GetOwner();
 
+  void AssertDepth(uint32_t depth) {
+#if !defined(__APPLE__)
+    DCHECK_EQ(depth, GetDepth());
+#endif
+  }
+
  private:
   static pid_t GetTid();
 
   void ClearOwner();
 
+  uint32_t GetDepth();
+
   std::string name_;
 
   pthread_mutex_t mutex_;