Turn the thread peer_ into a Object*.

Don't use a JNI global ref for the thread peer_ so that we can
support more threads than we can global refs. This fixes run-test 51.
Fix a race in thread destruction where a thread may be requested to
suspend while deleting itself.

Change-Id: Id8756a575becf80d2a0be0a213325034556927f1
diff --git a/src/thread_list.h b/src/thread_list.h
index d64183b..fb989ab 100644
--- a/src/thread_list.h
+++ b/src/thread_list.h
@@ -98,8 +98,8 @@
  private:
   typedef std::list<Thread*>::const_iterator It; // TODO: C++0x auto
 
-  uint32_t AllocThreadId();
-  void ReleaseThreadId(uint32_t id) LOCKS_EXCLUDED(allocated_ids_lock_);
+  uint32_t AllocThreadId(Thread* self);
+  void ReleaseThreadId(Thread* self, uint32_t id) LOCKS_EXCLUDED(allocated_ids_lock_);
 
   bool Contains(Thread* thread) EXCLUSIVE_LOCKS_REQUIRED(Locks::thread_list_lock_);
   bool Contains(pid_t tid) EXCLUSIVE_LOCKS_REQUIRED(Locks::thread_list_lock_);