Revert "Revert "Prevent races with GC when transferring objects between threads""

This reverts commit e5179ce0ca8becf34ba6e7b2f3988874fe647c26.

Reason for revert: Fixed issues with:
  Checkpoint flag set without pending checkpoint in parent CL.

Bug: 67838964
Test: ./test.py --host -j50

Change-Id: I7622f9c18866b58ee3cbd9f4fe38a29b2cf84a88
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 5881f8c..7db0566 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -395,7 +395,7 @@
   };
   GetContendedMonitorClosure closure(self, monitor);
   // RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
-  if (!target->RequestSynchronousCheckpoint(&closure)) {
+  if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(target, &closure)) {
     return ERR(THREAD_NOT_ALIVE);
   }
   return OK;