Convert futex to cond wait.

Switch to the better supported pthread_cond to handle the Wait/Wake
functions.

Also, increase the number of simultaneous threads in the thread tests.

Bug: 18381207
Change-Id: I63240208e8b7f641b3f35a3fc0bb1acf80dc796e
diff --git a/libbacktrace/BacktraceThread.h b/libbacktrace/BacktraceThread.h
index ff3e9f3..99a8638 100644
--- a/libbacktrace/BacktraceThread.h
+++ b/libbacktrace/BacktraceThread.h
@@ -48,8 +48,10 @@
 
   inline void Lock() {
     pthread_mutex_lock(&mutex_);
-    // Reset the futex value in case of multiple unwinds of the same thread.
-    futex_ = 0;
+
+    // Always reset the wait value since this could be the first or nth
+    // time this entry is locked.
+    wait_value_ = 0;
   }
 
   inline void Unlock() {
@@ -66,9 +68,11 @@
 
   pid_t pid_;
   pid_t tid_;
-  int futex_;
   int ref_count_;
   pthread_mutex_t mutex_;
+  pthread_mutex_t wait_mutex_;
+  pthread_cond_t wait_cond_;
+  int wait_value_;
   ThreadEntry* next_;
   ThreadEntry* prev_;
   ucontext_t ucontext_;