< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
Print this page
rev 56803 : 8233520: Shenandoah: do not sleep when threads are attaching
Reviewed-by: XXX
*** 236,245 ****
--- 236,254 ----
// Fast path: try to allocate right away
if (claim_for_alloc(words, false)) {
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();
size_t total = 0;
size_t cur = 0;
< prev index next >