mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8322846: Running with -Djdk.tracePinnedThreads set can hang
Reviewed-by: jpai
This commit is contained in:
parent
ace010b38a
commit
faa9c6909d
3 changed files with 116 additions and 28 deletions
|
@ -191,7 +191,15 @@ final class VirtualThread extends BaseVirtualThread {
|
|||
protected void onPinned(Continuation.Pinned reason) {
|
||||
if (TRACE_PINNING_MODE > 0) {
|
||||
boolean printAll = (TRACE_PINNING_MODE == 1);
|
||||
PinnedThreadPrinter.printStackTrace(System.out, printAll);
|
||||
VirtualThread vthread = (VirtualThread) Thread.currentThread();
|
||||
int oldState = vthread.state();
|
||||
try {
|
||||
// avoid printing when in transition states
|
||||
vthread.setState(RUNNING);
|
||||
PinnedThreadPrinter.printStackTrace(System.out, reason, printAll);
|
||||
} finally {
|
||||
vthread.setState(oldState);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static Runnable wrap(VirtualThread vthread, Runnable task) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue