# HG changeset patch # User shade # Date 1572892858 -3600 # Node ID c727d5d4c22eb2dcef21adb4add1f0ca127b7332 # Parent 33f9271b3167c1668bf99a9c09981c55bd6af31d 8233520: Shenandoah: do not sleep when thread is attaching Reviewed-by: rkennke diff -r 33f9271b3167 -r c727d5d4c22e src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp Mon Nov 04 13:13:34 2019 -0500 +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp Mon Nov 04 19:40:58 2019 +0100 @@ -238,6 +238,15 @@ return; } + // Threads that are attaching should not block at all: they are not + // fully initialized yet. Calling sleep() on them would be awkward. + // This is probably the path that allocates the thread oop itself. + // Forcefully claim without waiting. + if (JavaThread::current()->is_attaching_via_jni()) { + claim_for_alloc(words, true); + return; + } + size_t max = ShenandoahPacingMaxDelay; double start = os::elapsedTime();