$ java -Djdk.tracePinnedThreads=full VirtualThreadCompatibilityDemo   (pre-JDK-24 runtime)

java.version=21.0.10
jdk.tracePinnedThreads=full
CountDownLatch.await(): completed, no trace above this line for it
CyclicBarrier.await(): completed, no trace above this line for it
Phaser.arriveAndAwaitAdvance(): completed, no trace above this line for it
Semaphore.acquire(): completed, no trace above this line for it
done - no pinning trace printed above for any of the four

$ java -Djdk.tracePinnedThreads=full SynchronizedWaitPinsDemo   (pre-JDK-24 runtime, contrast case)

java.version=21.0.10
jdk.tracePinnedThreads=full
synchronized + Object.wait(): completed, no pinning trace above this line for it
VirtualThread[#21]/runnable@ForkJoinPool-1-worker-1 reason:MONITOR
    java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(VirtualThread.java:199)
    java.base/jdk.internal.vm.Continuation.onPinned0(Continuation.java:393)
    java.base/java.lang.VirtualThread.parkNanos(VirtualThread.java:635)
    java.base/java.lang.VirtualThread.sleepNanos(VirtualThread.java:807)
    java.base/java.lang.Thread.sleep(Thread.java:507)
    com.ankurm.synchronizers.SynchronizedWaitPinsDemo.lambda$main$1(SynchronizedWaitPinsDemo.java:48) <== monitors:1
    java.base/java.lang.VirtualThread.run(VirtualThread.java:329)
synchronized + Thread.sleep(): completed, pinning trace (if any) appears above this line for it
done
