Work on heap and space initialization to support image loading

Change-Id: Icab25efa4dee17e4b6c6e97e38f63f5ab8a8a005
diff --git a/src/thread.cc b/src/thread.cc
index aa3fe95..1001b29 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -55,7 +55,7 @@
 
 Thread* Thread::Create(const Runtime* runtime) {
   size_t stack_size = runtime->GetStackSize();
-  scoped_ptr<MemMap> stack(MemMap::Map(stack_size, PROT_READ | PROT_WRITE, MAP_PRIVATE));
+  scoped_ptr<MemMap> stack(MemMap::Map(stack_size, PROT_READ | PROT_WRITE));
   if (stack == NULL) {
     LOG(FATAL) << "failed to allocate thread stack";
     // notreached
@@ -212,9 +212,9 @@
   // Make sure that all threads have exited and unregistered when we
   // reach this point. This means that all daemon threads had been
   // shutdown cleanly.
-  CHECK_EQ(list_.size(), 1U);
+  CHECK_LE(list_.size(), 1U);
   // TODO: wait for all other threads to unregister
-  CHECK_EQ(list_.front(), Thread::Current());
+  CHECK(list_.size() == 0 || list_.front() == Thread::Current());
   // TODO: detach the current thread
   delete lock_;
   lock_ = NULL;