File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
test/jdk/java/lang/Thread/virtual Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 4040 */
4141
4242import java .util .concurrent .atomic .AtomicBoolean ;
43+ import java .util .concurrent .CountDownLatch ;
4344
4445import jdk .test .lib .thread .VThreadPinner ;
4546import org .junit .jupiter .api .Test ;
4647import static org .junit .jupiter .api .Assertions .*;
4748
4849class ThreadPollOnYield {
50+ private static final CountDownLatch started = new CountDownLatch (1 );
4951 static void foo (AtomicBoolean done ) {
52+ started .countDown ();
5053 while (!done .get ()) {
5154 Thread .yield ();
5255 }
@@ -58,7 +61,7 @@ void testThreadYieldPolls() throws Exception {
5861 var vthread = Thread .ofVirtual ().start (() -> {
5962 VThreadPinner .runPinned (() -> foo (done ));
6063 });
61- Thread . sleep ( 5000 );
64+ started . await ( );
6265 done .set (true );
6366 vthread .join ();
6467
You can’t perform that action at this time.
0 commit comments