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

Virtual Thread.yield consumes parking permit

    XMLWordPrintable

Details

    • b27
    • Verified

    Backports

      Description

        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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: