File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,13 @@ static void sleep(long millis) {
4444 }
4545 }
4646
47+ public void ensureReadyAndWaiting (Thread vt , Thread .State expState , ReentrantLock rlock ) {
48+ // wait while the thread is not ready or thread state is unexpected
49+ while (!threadReady || (vt .getState () != expState ) || !rlock .hasQueuedThreads ()) {
50+ sleep (1 );
51+ }
52+ }
53+
4754 public void ensureReady (Thread vt , Thread .State expState ) {
4855 // wait while the thread is not ready or thread state is unexpected
4956 while (!threadReady || (vt .getState () != expState )) {
@@ -97,7 +104,7 @@ private static void checkReentrantLock() throws InterruptedException {
97104 String name = "ReentrantLockTestTask" ;
98105 TestTask task = new ReentrantLockTestTask ();
99106 Thread vt = Thread .ofVirtual ().name (name ).start (task );
100- task .ensureReady (vt , expState );
107+ task .ensureReadyAndWaiting (vt , expState , reentrantLock );
101108 checkStates (vt , expState );
102109 }
103110
You can’t perform that action at this time.
0 commit comments