< prev index next >

src/hotspot/share/gc/shared/collectedHeap.cpp

Print this page

        

@@ -120,10 +120,21 @@
 
   return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space,
                           ms_chunk_free_list_summary, class_chunk_free_list_summary);
 }
 
+void CollectedHeap::run_task_at_safepoint(AbstractGangTask* task, uint num_workers) {
+  WorkGang* gang = get_safepoint_workers();
+  if (gang == NULL) {
+    // GC doesn't support parallel worker threads.
+    // Execute in this thread with worker id 0.
+    task->work(0);
+  } else {
+    gang->run_task(task, num_workers);
+  }
+}
+
 void CollectedHeap::print_heap_before_gc() {
   Universe::print_heap_before_gc();
   if (_gc_heap_log != NULL) {
     _gc_heap_log->log_heap_before(this);
   }
< prev index next >