Add safepoint callback for gc
This change adds a safepoint callback registration mechanism.
On a per-thread (or all-thread) basis, you pass in a function to be
called at the next safe point by the target thread. That if that
function returns 0, it will be automatically disarmed. If not,
the callback will stay in effect and the function will be called
on all subsequent safe points.
GC is the expected customer of this feature.
Change-Id: Icd3b93128b1fd547e142d047a12df7ae8ee646e3
diff --git a/vm/Thread.c b/vm/Thread.c
index 69c56e8..4db32fc 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -944,6 +944,9 @@
pthread_cond_init(&thread->waitCond, NULL);
dvmInitMutex(&thread->waitMutex);
+ /* Initialize safepoint callback mechanism */
+ dvmInitMutex(&thread->callbackMutex);
+
return true;
}