< prev index next >

src/share/vm/gc/shenandoah/shenandoahConcurrentMark.cpp

Print this page
rev 12191 : [mq]: cancel.patch

@@ -880,18 +880,24 @@
                                                     uint worker_id,
                                                     SCMObjToScanQueue* q,
                                                     ParallelTaskTerminator* terminator) {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
   int seed = 17;
+  uint stride = ShenandoahMarkLoopStride;
   while (true) {
-    if (heap->cancelled_concgc()) clear_queue(q);
-    if (heap->cancelled_concgc() ||
-        (!try_queue(q, cl) &&
+    if (heap->cancelled_concgc()) {
+      clear_queue(q);
+      while (! terminator->offer_termination());
+      return;
+    }
+    for (uint i = 0; i < stride; i++) {
+      if (!try_queue(q, cl) &&
          !try_draining_an_satb_buffer(q) &&
-         !try_to_steal(worker_id, cl, &seed))
+          !try_to_steal(worker_id, cl, &seed)
         ) {
-      if (terminator->offer_termination()) break;
+        if (terminator->offer_termination()) return;
+      }
     }
   }
 }
 
 template <class T, bool CL>
< prev index next >