Thread.join, GC daemons, suspend daemons on shutdown, and wait for non-daemon threads to exit.
(I've been testing with a modified SystemMethods test that does various thread
operations.)
Change-Id: I3087087546f90c43da7a0e63fae918ff0a6e7005
diff --git a/src/thread_list.h b/src/thread_list.h
index aa1415a..32bcf20 100644
--- a/src/thread_list.h
+++ b/src/thread_list.h
@@ -52,14 +52,18 @@
private:
typedef std::list<Thread*>::const_iterator It; // TODO: C++0x auto
+ bool AllThreadsAreDaemons();
uint32_t AllocThreadId();
void ReleaseThreadId(uint32_t id);
+ void SuspendAllDaemonThreads();
+ void WaitForNonDaemonThreadsToExit();
mutable Mutex thread_list_lock_;
std::bitset<kMaxThreadId> allocated_ids_;
std::list<Thread*> list_;
ConditionVariable thread_start_cond_;
+ ConditionVariable thread_exit_cond_;
// This lock guards every thread's suspend_count_ field...
mutable Mutex thread_suspend_count_lock_;