3 ms·
> Not mention all the Netty / reactive libraries have no use now (not that I am complaining). Netty uses an eventloop/async paradigm. The benefit of that style
by munksbeer 2y ago
> Not mention all the Netty / reactive libraries have no use now (not that I am complaining).
Netty uses an eventloop/async paradigm. The benefit of that style is you do not need any locking (within the same eventloop). How does virtual threads make that of no use?
- rockyj 2y agoNo need for complex async / event loop stuff. VTs can be spawned by millions and they will not block the thread (/CPU) while doing IO, in this (win-win) scenario there is no value in doing complex (and 2 colored) async programming.
- munksbeer 2y agoYou didn't answer the question though. When I use a single threaded event loop with async style, I don't need to use any locks. It isn't about efficiency, it is about low complexity because I don't need to reason about shared state. Is it good practice or not to use locking semantics if you use virtual threads?
- samus 2y agoIt is totally fine to use locking with virtual threads. Of course you don't need it if you don't have to restrict access to shared resources in the first place (for example a connection pool or a datastructure with internal invariants that have to be maintained) or if lockless alternatives are available.