Ensure ThreadPool constructor does not return until fully initialized.

Thread pool was being deleted too early during runtime shutdown,
this was causing a GC running during runtime shutdown to
occasionally reference a deleted thread pool.

Fixed an error where the thread pool was being deleted before the
threads were done attaching by making the thread pool constructor
block until all of the threads are attached.

Change-Id: I5f0884a74d78c4541ee0e582112857077f3f594f
diff --git a/src/thread_pool.h b/src/thread_pool.h
index c8f6056..668dfe0 100644
--- a/src/thread_pool.h
+++ b/src/thread_pool.h
@@ -20,6 +20,7 @@
 #include <deque>
 #include <vector>
 
+#include "barrier.h"
 #include "closure.h"
 #include "locks.h"
 #include "../src/mutex.h"
@@ -114,6 +115,7 @@
   // Work balance detection.
   uint64_t start_time_ GUARDED_BY(task_queue_lock_);
   uint64_t total_wait_time_;
+  Barrier creation_barier_;
 
   friend class ThreadPoolWorker;
   friend class WorkStealingWorker;