|
|
|
|
|
by spintin
885 days ago
|
|
https://www.youtube.com/watch?v=WoQJnnMIlFY&t=260s To get the whole context, so virtual threads are unusable? What holds a monitor by default and is there a workaround? Found more: A virtual thread cannot be unmounted during blocking operations when it is pinned to its carrier. A virtual thread is pinned in the following situations:
The virtual thread runs code inside a synchronized block or method
The virtual thread runs a native method or a foreign function (see Foreign Function and Memory API)
For those those that don't know what this means: Blocking network TCP IO needs a sychronized block to work = you can't use virtual threads for networking. I wish they formulated it like that from the start!Atleast now we know what they meant with don't use virtual threads for anything but tasks <- not blocking IO with synchronization! So for now manual NIO is still the king of the hill. We are reaching peak humanity levels of complexity! |
|
That’s not true — blocking TCP IO is not implemented as blocking under the hood - that’s the whole point of virtual threads, so your conclusion is faulty.