< prev index next >
src/hotspot/share/gc/shared/concurrentGCThread.cpp
Print this page
*** 28,38 ****
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
ConcurrentGCThread::ConcurrentGCThread() :
- _monitor(Monitor::leaf, "ConcurrentGCThread"),
_should_terminate(false),
_has_terminated(false) {}
void ConcurrentGCThread::create_and_start(ThreadPriority prio) {
if (os::create_thread(this, os::cgc_thread)) {
--- 28,37 ----
*** 49,59 ****
wait_init_completed();
run_service();
// Signal thread has terminated
! MonitorLockerEx ml(&_monitor);
OrderAccess::release_store(&_has_terminated, true);
ml.notify_all();
}
void ConcurrentGCThread::stop() {
--- 48,58 ----
wait_init_completed();
run_service();
// Signal thread has terminated
! MonitorLockerEx ml(Terminator_lock);
OrderAccess::release_store(&_has_terminated, true);
ml.notify_all();
}
void ConcurrentGCThread::stop() {
*** 64,74 ****
OrderAccess::release_store(&_should_terminate, true);
stop_service();
// Wait for thread to terminate
! MonitorLockerEx ml(&_monitor);
while (!_has_terminated) {
ml.wait();
}
}
--- 63,73 ----
OrderAccess::release_store(&_should_terminate, true);
stop_service();
// Wait for thread to terminate
! MonitorLockerEx ml(Terminator_lock);
while (!_has_terminated) {
ml.wait();
}
}
< prev index next >