Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8321270

Virtual Thread.yield consumes parking permit

XMLWordPrintable

    • b27
    • Verified

        When a virtual thread continues after Thread.yield it consume the thread parking permit:

                var thread = Thread.ofVirtual().start(() -> {
                    LockSupport.unpark(Thread.currentThread());
                    Thread.yield();
                    LockSupport.park(); // should not park
                });
                thread.join();

        The parking permit should only be consumed when continuing after park.

              alanb Alan Bateman
              alanb Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: