News for hackers. Stuff that matters.
Re:Java 21 Released by jayd16 on Tuesday September 19, 2023 @11:59AM (#37571878)
A common pattern is to use a single thread executor as one context. Any task scheduled to that context will not run concurrently. When you do it this way, every synchronous chunk (between yields/awaits) is a critical section. So you get critical sections easily, cheaply and with a pretty good syntax.

This pattern is used a lot when you have things like UI which use a single threaded design, or if you need to bind to do some IPC in a single native thread. It's actually very common.

There are no comments on this comment yet.