News for hackers. Stuff that matters.
Re:Why choose async/await over threads? by dehrmann on Monday March 25, 2024 @02:58AM (#39813389)
async can be scarier for locks since a block of code might depend on having exclusive access, and since there wasn't an await, it got it. Once you add an await in the middle, the code breaks. Threading at least makes you codify what actually needs exclusive access.

async also signs you up for managing your own thread scheduling. If you have a lot of IO and short CPU-bound code, this can be OK. If you have (or occasionally have) CPU-bound code, you'll find yourself playing scheduler.

Re:Why choose async/await over threads? by cageface on Monday March 25, 2024 @03:13AM (#39813454)
Yeah once your app gets to be sufficiently complex you will find yourself needing mutexes after all. Async/await makes the easy parts of concurrency easy but the hard parts are still hard.