< prev index next >

src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp

Print this page
rev 7318 : imported patch foreground


 117       CGC_lock->wait(true, 200);
 118       loopX.tick();
 119     }
 120     // Wait until the surrogate locker thread that will do
 121     // pending list locking on our behalf has been created.
 122     // We cannot start the SLT thread ourselves since we need
 123     // to be a JavaThread to do so.
 124     CMSLoopCountWarn loopY("CMS::run", "waiting for SLT installation", 2);
 125     while (_slt == NULL && !_should_terminate) {
 126       CGC_lock->wait(true, 200);
 127       loopY.tick();
 128     }
 129     clear_CMS_flag(CMS_cms_wants_token);
 130   }
 131 
 132   while (!_should_terminate) {
 133     sleepBeforeNextCycle();
 134     if (_should_terminate) break;
 135     GCCause::Cause cause = _collector->_full_gc_requested ?
 136       _collector->_full_gc_cause : GCCause::_cms_concurrent_mark;
 137     _collector->collect_in_background(false, cause);
 138   }
 139   assert(_should_terminate, "just checking");
 140   // Check that the state of any protocol for synchronization
 141   // between background (CMS) and foreground collector is "clean"
 142   // (i.e. will not potentially block the foreground collector,
 143   // requiring action by us).
 144   verify_ok_to_terminate();
 145   // Signal that it is terminated
 146   {
 147     MutexLockerEx mu(Terminator_lock,
 148                      Mutex::_no_safepoint_check_flag);
 149     assert(_cmst == this, "Weird!");
 150     _cmst = NULL;
 151     Terminator_lock->notify();
 152   }
 153 
 154   // Thread destructor usually does this..
 155   ThreadLocalStorage::set_thread(NULL);
 156 }
 157 




 117       CGC_lock->wait(true, 200);
 118       loopX.tick();
 119     }
 120     // Wait until the surrogate locker thread that will do
 121     // pending list locking on our behalf has been created.
 122     // We cannot start the SLT thread ourselves since we need
 123     // to be a JavaThread to do so.
 124     CMSLoopCountWarn loopY("CMS::run", "waiting for SLT installation", 2);
 125     while (_slt == NULL && !_should_terminate) {
 126       CGC_lock->wait(true, 200);
 127       loopY.tick();
 128     }
 129     clear_CMS_flag(CMS_cms_wants_token);
 130   }
 131 
 132   while (!_should_terminate) {
 133     sleepBeforeNextCycle();
 134     if (_should_terminate) break;
 135     GCCause::Cause cause = _collector->_full_gc_requested ?
 136       _collector->_full_gc_cause : GCCause::_cms_concurrent_mark;
 137     _collector->collect_in_background(cause);
 138   }
 139   assert(_should_terminate, "just checking");
 140   // Check that the state of any protocol for synchronization
 141   // between background (CMS) and foreground collector is "clean"
 142   // (i.e. will not potentially block the foreground collector,
 143   // requiring action by us).
 144   verify_ok_to_terminate();
 145   // Signal that it is terminated
 146   {
 147     MutexLockerEx mu(Terminator_lock,
 148                      Mutex::_no_safepoint_check_flag);
 149     assert(_cmst == this, "Weird!");
 150     _cmst = NULL;
 151     Terminator_lock->notify();
 152   }
 153 
 154   // Thread destructor usually does this..
 155   ThreadLocalStorage::set_thread(NULL);
 156 }
 157 


< prev index next >