< prev index next >

src/share/vm/gc/shared/concurrentGCThread.cpp

Print this page
rev 10389 : imported patch webrev.01
rev 10390 : imported patch webrev.02

*** 35,50 **** ConcurrentGCThread::ConcurrentGCThread() : _should_terminate(false), _has_terminated(false) { }; ! void ConcurrentGCThread::create_and_start() { if (os::create_thread(this, os::cgc_thread)) { // XXX: need to set this to low priority // unless "aggressive mode" set; priority // should be just less than that of VMThread. ! os::set_priority(this, NearMaxPriority); if (!_should_terminate && !DisableStartThread) { os::start_thread(this); } } } --- 35,50 ---- ConcurrentGCThread::ConcurrentGCThread() : _should_terminate(false), _has_terminated(false) { }; ! void ConcurrentGCThread::create_and_start(ThreadPriority prio) { if (os::create_thread(this, os::cgc_thread)) { // XXX: need to set this to low priority // unless "aggressive mode" set; priority // should be just less than that of VMThread. ! os::set_priority(this, prio); if (!_should_terminate && !DisableStartThread) { os::start_thread(this); } } }
*** 73,82 **** --- 73,110 ---- _has_terminated = true; Terminator_lock->notify(); } } + void ConcurrentGCThread::run() { + initialize_in_thread(); + wait_for_universe_init(); + + run_service(); + + terminate(); + } + + void ConcurrentGCThread::stop() { + // it is ok to take late safepoints here, if needed + { + MutexLockerEx mu(Terminator_lock); + assert(!_has_terminated, "stop should only be called once"); + assert(!_should_terminate, "stop should only be called once"); + _should_terminate = true; + } + + stop_service(); + + { + MutexLockerEx mu(Terminator_lock); + while (!_has_terminated) { + Terminator_lock->wait(); + } + } + } + static void _sltLoop(JavaThread* thread, TRAPS) { SurrogateLockerThread* slt = (SurrogateLockerThread*)thread; slt->loop(); }
< prev index next >