3 ms·
The specific edge case which is most annoying here is that locking a Java object with synchronized converts all the non-blocking calls that Loom does further do
by CHY872 3y ago
The specific edge case which is most annoying here is that locking a Java object with synchronized converts all the non-blocking calls that Loom does further down the stack to be blocking ones, which then lock up your carrier threads. So you get this action as a distance thing.
E.g.
for (int i = 0; i < 500; i++) {
newVirtualThread(() -> synchronized (new Object()) {
Thread.sleep(100_000);
});
}
will blow up your JVM (modulo some compensation mechanisms that work definitely kinda) and that's odd.