Async features in almost all popular languages are a single thread running an event loop (Go being an exception there I believe). Multi threading is still quite difficult to get right if the task isn’t trivially parallelizable.
My goto for easy multi threading is lock free queues. Generate work on one thread and queue it up for another thread to process. Easy message passing and stuff like that. It doesn’t solve everything but it can do a lot if you are creative with them. As long as you maintain a single thread ownership of memory and just pass it around the threads via message passing on queues, everything just sorta works out.
Async features in almost all popular languages are a single thread running an event loop (Go being an exception there I believe). Multi threading is still quite difficult to get right if the task isn’t trivially parallelizable.
Wait, wat? Looking at first sentence. Also async != multi threading.
Exactly.
Also every time I’ve used async stuff, I’ve pined for proper threads. Continuation spaghetti isn’t my bag.
My goto for easy multi threading is lock free queues. Generate work on one thread and queue it up for another thread to process. Easy message passing and stuff like that. It doesn’t solve everything but it can do a lot if you are creative with them. As long as you maintain a single thread ownership of memory and just pass it around the threads via message passing on queues, everything just sorta works out.
Don’t use goto.