< prev index next >

src/share/vm/gc/cms/concurrentMarkSweepThread.cpp

Print this page
rev 10389 : imported patch webrev.01
rev 10390 : imported patch webrev.02
rev 10391 : [mq]: webrev.03
rev 10392 : imported patch webrev.04

@@ -92,20 +92,20 @@
     // Wait until the surrogate locker thread that will do
     // pending list locking on our behalf has been created.
     // We cannot start the SLT thread ourselves since we need
     // to be a JavaThread to do so.
     CMSLoopCountWarn loopY("CMS::run", "waiting for SLT installation", 2);
-    while (_slt == NULL && !_should_terminate) {
+    while (_slt == NULL && !should_terminate()) {
       CGC_lock->wait(true, 200);
       loopY.tick();
     }
     clear_CMS_flag(CMS_cms_wants_token);
   }
 
-  while (!_should_terminate) {
+  while (!should_terminate()) {
     sleepBeforeNextCycle();
-    if (_should_terminate) break;
+    if (should_terminate()) break;
     GCIdMark gc_id_mark;
     GCCause::Cause cause = _collector->_full_gc_requested ?
       _collector->_full_gc_cause : GCCause::_cms_concurrent_mark;
     _collector->collect_in_background(cause);
   }

@@ -147,11 +147,11 @@
   CGC_lock->notify_all();
 }
 
 void ConcurrentMarkSweepThread::threads_do(ThreadClosure* tc) {
   assert(tc != NULL, "Null ThreadClosure");
-  if (cmst() != NULL) {
+  if (cmst() != NULL && !cmst()->has_terminated()) {
     tc->do_thread(cmst());
   }
   assert(Universe::is_fully_initialized(),
          "Called too early, make sure heap is fully initialized");
   if (_collector != NULL) {

@@ -161,11 +161,11 @@
     }
   }
 }
 
 void ConcurrentMarkSweepThread::print_all_on(outputStream* st) {
-  if (cmst() != NULL) {
+  if (cmst() != NULL && !cmst()->has_terminated()) {
     cmst()->print_on(st);
     st->cr();
   }
   if (_collector != NULL) {
     AbstractWorkGang* gang = _collector->conc_workers();

@@ -237,11 +237,11 @@
 
 // Wait until any cms_lock event
 void ConcurrentMarkSweepThread::wait_on_cms_lock(long t_millis) {
   MutexLockerEx x(CGC_lock,
                   Mutex::_no_safepoint_check_flag);
-  if (_should_terminate || _collector->_full_gc_requested) {
+  if (should_terminate() || _collector->_full_gc_requested) {
     return;
   }
   set_CMS_flag(CMS_cms_wants_token);   // to provoke notifies
   CGC_lock->wait(Mutex::_no_safepoint_check_flag, t_millis);
   clear_CMS_flag(CMS_cms_wants_token);

@@ -266,11 +266,11 @@
     before_count = gch->total_collections();
   }
 
   unsigned int loop_count = 0;
 
-  while(!_should_terminate) {
+  while(!should_terminate()) {
     double now_time = os::elapsedTime();
     long wait_time_millis;
 
     if(t_millis != 0) {
       // New wait limit

@@ -286,11 +286,11 @@
 
     // Wait until the next event or the remaining timeout
     {
       MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
 
-      if (_should_terminate || _collector->_full_gc_requested) {
+      if (should_terminate() || _collector->_full_gc_requested) {
         return;
       }
       set_CMS_flag(CMS_cms_wants_token);   // to provoke notifies
       assert(t_millis == 0 || wait_time_millis > 0, "Sanity");
       CGC_lock->wait(Mutex::_no_safepoint_check_flag, wait_time_millis);

@@ -323,11 +323,11 @@
     }
   }
 }
 
 void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
-  while (!_should_terminate) {
+  while (!should_terminate()) {
     if(CMSWaitDuration >= 0) {
       // Wait until the next synchronous GC, a concurrent full gc
       // request or a timeout, whichever is earlier.
       wait_on_cms_lock_for_scavenge(CMSWaitDuration);
     } else {
< prev index next >