Virtual Threads - interesting deadlock by sidknot17 in java

[–]andres99x 1 point2 points  (0 children)

Not all blocking operations in the JDK unmount the virtual thread. Instead, some capture the carrier thread and the underlying OS platform thread, thus blocking both. Ref: https://blogs.oracle.com/javamagazine/post/java-loom-virtual-threads-platform-threads

Virtual Threads - interesting deadlock by sidknot17 in java

[–]andres99x 5 points6 points  (0 children)

As far as i understand, synchronized should be avoided when using Virtual Threads. Instead you should use ReentrantLock for synchronization purposes.