37 int ConcurrentGCThread::_CGC_flag = CGC_nil;
38
39 SuspendibleThreadSet ConcurrentGCThread::_sts;
40
41 ConcurrentGCThread::ConcurrentGCThread() :
42 _should_terminate(false), _has_terminated(false) {
43 _sts.initialize();
44 };
45
46 void ConcurrentGCThread::safepoint_synchronize() {
47 _sts.suspend_all();
48 }
49
50 void ConcurrentGCThread::safepoint_desynchronize() {
51 _sts.resume_all();
52 }
53
54 void ConcurrentGCThread::create_and_start() {
55 if (os::create_thread(this, os::cgc_thread)) {
56 // XXX: need to set this to low priority
57 // unless "agressive mode" set; priority
58 // should be just less than that of VMThread.
59 os::set_priority(this, NearMaxPriority);
60 if (!_should_terminate && !DisableStartThread) {
61 os::start_thread(this);
62 }
63 }
64 }
65
66 void ConcurrentGCThread::initialize_in_thread() {
67 this->record_stack_base_and_size();
68 this->initialize_thread_local_storage();
69 this->set_active_handles(JNIHandleBlock::allocate_block());
70 // From this time Thread::current() should be working.
71 assert(this == Thread::current(), "just checking");
72 }
73
74 void ConcurrentGCThread::wait_for_universe_init() {
75 MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
76 while (!is_init_completed() && !_should_terminate) {
77 CGC_lock->wait(Mutex::_no_safepoint_check_flag, 200);
|
37 int ConcurrentGCThread::_CGC_flag = CGC_nil;
38
39 SuspendibleThreadSet ConcurrentGCThread::_sts;
40
41 ConcurrentGCThread::ConcurrentGCThread() :
42 _should_terminate(false), _has_terminated(false) {
43 _sts.initialize();
44 };
45
46 void ConcurrentGCThread::safepoint_synchronize() {
47 _sts.suspend_all();
48 }
49
50 void ConcurrentGCThread::safepoint_desynchronize() {
51 _sts.resume_all();
52 }
53
54 void ConcurrentGCThread::create_and_start() {
55 if (os::create_thread(this, os::cgc_thread)) {
56 // XXX: need to set this to low priority
57 // unless "aggressive mode" set; priority
58 // should be just less than that of VMThread.
59 os::set_priority(this, NearMaxPriority);
60 if (!_should_terminate && !DisableStartThread) {
61 os::start_thread(this);
62 }
63 }
64 }
65
66 void ConcurrentGCThread::initialize_in_thread() {
67 this->record_stack_base_and_size();
68 this->initialize_thread_local_storage();
69 this->set_active_handles(JNIHandleBlock::allocate_block());
70 // From this time Thread::current() should be working.
71 assert(this == Thread::current(), "just checking");
72 }
73
74 void ConcurrentGCThread::wait_for_universe_init() {
75 MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
76 while (!is_init_completed() && !_should_terminate) {
77 CGC_lock->wait(Mutex::_no_safepoint_check_flag, 200);
|