equal
deleted
inserted
replaced
224 PerfDataManager::create_counter(SUN_THREADS, "vmOperationTime", |
224 PerfDataManager::create_counter(SUN_THREADS, "vmOperationTime", |
225 PerfData::U_Ticks, CHECK); |
225 PerfData::U_Ticks, CHECK); |
226 } |
226 } |
227 } |
227 } |
228 |
228 |
229 |
|
230 VMThread::VMThread() : NamedThread() { |
229 VMThread::VMThread() : NamedThread() { |
231 set_name("VM Thread"); |
230 set_name("VM Thread"); |
232 } |
231 } |
233 |
232 |
234 void VMThread::destroy() { |
233 void VMThread::destroy() { |
235 if (_vm_thread != NULL) { |
234 _vm_thread = NULL; // VM thread is gone |
236 delete _vm_thread; |
|
237 _vm_thread = NULL; // VM thread is gone |
|
238 } |
|
239 } |
235 } |
240 |
236 |
241 void VMThread::run() { |
237 void VMThread::run() { |
242 assert(this == vm_thread(), "check"); |
238 assert(this == vm_thread(), "check"); |
243 |
239 |
306 MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag); |
302 MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag); |
307 _terminated = true; |
303 _terminated = true; |
308 _terminate_lock->notify(); |
304 _terminate_lock->notify(); |
309 } |
305 } |
310 |
306 |
311 // Deletion must be done synchronously by the JNI DestroyJavaVM thread |
307 // We are now racing with the VM termination being carried out in |
312 // so that the VMThread deletion completes before the main thread frees |
308 // another thread, so we don't "delete this". Numerous threads don't |
313 // up the CodeHeap. |
309 // get deleted when the VM terminates |
314 |
310 |
315 } |
311 } |
316 |
312 |
317 |
313 |
318 // Notify the VMThread that the last non-daemon JavaThread has terminated, |
314 // Notify the VMThread that the last non-daemon JavaThread has terminated, |