71 void ConcurrentGCThread::terminate() {
72 // Signal that it is terminated
73 {
74 MutexLockerEx mu(Terminator_lock,
75 Mutex::_no_safepoint_check_flag);
76 _has_terminated = true;
77 Terminator_lock->notify();
78 }
79
80 // Thread destructor usually does this..
81 ThreadLocalStorage::set_thread(NULL);
82 }
83
84 static void _sltLoop(JavaThread* thread, TRAPS) {
85 SurrogateLockerThread* slt = (SurrogateLockerThread*)thread;
86 slt->loop();
87 }
88
89 SurrogateLockerThread::SurrogateLockerThread() :
90 JavaThread(&_sltLoop),
91 _monitor(Mutex::nonleaf, "SLTMonitor"),
92 _buffer(empty)
93 {}
94
95 SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) {
96 Klass* k =
97 SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(),
98 true, CHECK_NULL);
99 instanceKlassHandle klass (THREAD, k);
100 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL);
101
102 const char thread_name[] = "Surrogate Locker Thread (Concurrent GC)";
103 Handle string = java_lang_String::create_from_str(thread_name, CHECK_NULL);
104
105 // Initialize thread_oop to put it into the system threadGroup
106 Handle thread_group (THREAD, Universe::system_thread_group());
107 JavaValue result(T_VOID);
108 JavaCalls::call_special(&result, thread_oop,
109 klass,
110 vmSymbols::object_initializer_name(),
111 vmSymbols::threadgroup_string_void_signature(),
|
71 void ConcurrentGCThread::terminate() {
72 // Signal that it is terminated
73 {
74 MutexLockerEx mu(Terminator_lock,
75 Mutex::_no_safepoint_check_flag);
76 _has_terminated = true;
77 Terminator_lock->notify();
78 }
79
80 // Thread destructor usually does this..
81 ThreadLocalStorage::set_thread(NULL);
82 }
83
84 static void _sltLoop(JavaThread* thread, TRAPS) {
85 SurrogateLockerThread* slt = (SurrogateLockerThread*)thread;
86 slt->loop();
87 }
88
89 SurrogateLockerThread::SurrogateLockerThread() :
90 JavaThread(&_sltLoop),
91 _monitor(Mutex::nonleaf, "SLTMonitor", false,
92 Monitor::_safepoint_check_sometimes),
93 _buffer(empty)
94 {}
95
96 SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) {
97 Klass* k =
98 SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(),
99 true, CHECK_NULL);
100 instanceKlassHandle klass (THREAD, k);
101 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL);
102
103 const char thread_name[] = "Surrogate Locker Thread (Concurrent GC)";
104 Handle string = java_lang_String::create_from_str(thread_name, CHECK_NULL);
105
106 // Initialize thread_oop to put it into the system threadGroup
107 Handle thread_group (THREAD, Universe::system_thread_group());
108 JavaValue result(T_VOID);
109 JavaCalls::call_special(&result, thread_oop,
110 klass,
111 vmSymbols::object_initializer_name(),
112 vmSymbols::threadgroup_string_void_signature(),
|