Add a way to SuspendAll for a long duration

Hprof uses this mode to not cause thread suspend timeouts if GC tries
while the hprof dump is running.

(cherry picked from commit 77be6635f9b07a8a794924c5fb9b071949776a6d)

Bug: 21063989
Change-Id: Ic6304620afd1489719a7e0e4299f829c90fe27cc
diff --git a/runtime/thread_list.h b/runtime/thread_list.h
index 0f094cc..2c1f813 100644
--- a/runtime/thread_list.h
+++ b/runtime/thread_list.h
@@ -61,7 +61,9 @@
       LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_);
 
   // Suspends all threads and gets exclusive access to the mutator_lock_.
-  void SuspendAll(const char* cause)
+  // If long suspend is true, then other people who try to suspend will never timeout. Long suspend
+  // is currenly used for hprof since large heaps take a long time.
+  void SuspendAll(const char* cause, bool long_suspend = false)
       EXCLUSIVE_LOCK_FUNCTION(Locks::mutator_lock_)
       LOCKS_EXCLUDED(Locks::thread_list_lock_,
                      Locks::thread_suspend_count_lock_);
@@ -184,6 +186,9 @@
   // by mutator lock ensures no thread can read when another thread is modifying it.
   Histogram<uint64_t> suspend_all_historam_ GUARDED_BY(Locks::mutator_lock_);
 
+  // Whether or not the current thread suspension is long.
+  bool long_suspend_;
+
   friend class Thread;
 
   DISALLOW_COPY_AND_ASSIGN(ThreadList);