343 // sigexitnum_pd is a platform-specific special signal used for terminating the Signal thread. 344 345 346 static void signal_thread_entry(JavaThread* thread, TRAPS) { 347 os::set_priority(thread, NearMaxPriority); 348 while (true) { 349 int sig; 350 { 351 // FIXME : Currently we have not decided what should be the status 352 // for this java thread blocked here. Once we decide about 353 // that we should fix this. 354 sig = os::signal_wait(); 355 } 356 if (sig == os::sigexitnum_pd()) { 357 // Terminate the signal thread 358 return; 359 } 360 361 switch (sig) { 362 case SIGBREAK: { 363 // Check if the signal is a trigger to start the Attach Listener - in that 364 // case don't print stack traces. 365 if (!DisableAttachMechanism) { 366 // Attempt to transit state to AL_INITIALIZING. 367 AttachListenerState cur_state = AttachListener::transit_state(AL_INITIALIZING, AL_NOT_INITIALIZED); 368 if (cur_state == AL_INITIALIZING) { 369 // Attach Listener has been started to initialize. Ignore this signal. 370 continue; 371 } else if (cur_state == AL_NOT_INITIALIZED) { 372 // Start to initialize. 373 if (AttachListener::is_init_trigger()) { 374 // Attach Listener has been initialized. 375 // Accept subsequent request. 376 continue; 377 } else { 378 // Attach Listener could not be started. 379 // So we need to transit the state to AL_NOT_INITIALIZED. 380 AttachListener::set_state(AL_NOT_INITIALIZED); 381 } 382 } else if (AttachListener::check_socket_file()) { 383 // Attach Listener has been started, but unix domain socket file 384 // does not exist. So restart Attach Listener. 385 continue; 386 } 387 } 388 // Print stack traces 389 // Any SIGBREAK operations added here should make sure to flush 390 // the output stream (e.g. tty->flush()) after output. See 4803766. 391 // Each module also prints an extra carriage return after its output. 392 VM_PrintThreads op; 393 VMThread::execute(&op); 394 VM_PrintJNI jni_op; 395 VMThread::execute(&jni_op); 396 VM_FindDeadlocks op1(tty); 397 VMThread::execute(&op1); 398 Universe::print_heap_at_SIGBREAK(); 399 if (PrintClassHistogram) { 400 VM_GC_HeapInspection op1(tty, true /* force full GC before heap inspection */); 401 VMThread::execute(&op1); 402 } 403 if (JvmtiExport::should_post_data_dump()) { 404 JvmtiExport::post_data_dump(); 405 } 406 break; 407 } | 343 // sigexitnum_pd is a platform-specific special signal used for terminating the Signal thread. 344 345 346 static void signal_thread_entry(JavaThread* thread, TRAPS) { 347 os::set_priority(thread, NearMaxPriority); 348 while (true) { 349 int sig; 350 { 351 // FIXME : Currently we have not decided what should be the status 352 // for this java thread blocked here. Once we decide about 353 // that we should fix this. 354 sig = os::signal_wait(); 355 } 356 if (sig == os::sigexitnum_pd()) { 357 // Terminate the signal thread 358 return; 359 } 360 361 switch (sig) { 362 case SIGBREAK: { 363 #if INCLUDE_SERVICES 364 // Check if the signal is a trigger to start the Attach Listener - in that 365 // case don't print stack traces. 366 if (!DisableAttachMechanism) { 367 // Attempt to transit state to AL_INITIALIZING. 368 AttachListenerState cur_state = AttachListener::transit_state(AL_INITIALIZING, AL_NOT_INITIALIZED); 369 if (cur_state == AL_INITIALIZING) { 370 // Attach Listener has been started to initialize. Ignore this signal. 371 continue; 372 } else if (cur_state == AL_NOT_INITIALIZED) { 373 // Start to initialize. 374 if (AttachListener::is_init_trigger()) { 375 // Attach Listener has been initialized. 376 // Accept subsequent request. 377 continue; 378 } else { 379 // Attach Listener could not be started. 380 // So we need to transit the state to AL_NOT_INITIALIZED. 381 AttachListener::set_state(AL_NOT_INITIALIZED); 382 } 383 } else if (AttachListener::check_socket_file()) { 384 // Attach Listener has been started, but unix domain socket file 385 // does not exist. So restart Attach Listener. 386 continue; 387 } 388 } 389 #endif 390 // Print stack traces 391 // Any SIGBREAK operations added here should make sure to flush 392 // the output stream (e.g. tty->flush()) after output. See 4803766. 393 // Each module also prints an extra carriage return after its output. 394 VM_PrintThreads op; 395 VMThread::execute(&op); 396 VM_PrintJNI jni_op; 397 VMThread::execute(&jni_op); 398 VM_FindDeadlocks op1(tty); 399 VMThread::execute(&op1); 400 Universe::print_heap_at_SIGBREAK(); 401 if (PrintClassHistogram) { 402 VM_GC_HeapInspection op1(tty, true /* force full GC before heap inspection */); 403 VMThread::execute(&op1); 404 } 405 if (JvmtiExport::should_post_data_dump()) { 406 JvmtiExport::post_data_dump(); 407 } 408 break; 409 } |