OSDN Git Service

Allow the VM to suspend while the heap worker initializes.
authorCarl Shapiro <cshapiro@google.com>
Sat, 24 Jul 2010 01:11:27 +0000 (18:11 -0700)
committerBrian Carlstrom <bdc@google.com>
Thu, 29 Jul 2010 21:42:21 +0000 (14:42 -0700)
commit541c2ea9a2b0252ebb51ed239a4499a29f1ddbc0
tree7892d3ee4168a8aabdbba8e641cc5b6ee085277e
parente6899ef57ca0bea419992ab9dd83b8ca65854284
Allow the VM to suspend while the heap worker initializes.

The concurrent collector may initiate a collection, holding the heap
worker lock, while the heap worker thread starts up.  This causes the
thread suspension to wait indefinitely for the heap worker thread and
forces a VM abort.  The following stack trace is logged:

  #00 __futex_syscall3
  #01 pthread_mutex_lock<-_normal_lock
  #02 heapWorkerThreadStart<-dvmLockMutex
  #03 internalThreadStart
  #04 __thread_entry
  #05 pthread_create

This change puts the heap worker thread in to the VM wait state while
it acquires its locks during startup thereby avoiding the crash.  The
first dvmLockMutex substituted seems to have quelled the crashes at
startup.  The second may be unnecessary but seems benign.
vm/alloc/HeapWorker.c