Re:Go-like channels in 10 lines of JavaScript
by vore on Saturday February 04, 2023 @07:24PM
(#34660090)
In an async function, the only guarantee you have is that code between two await points is not interruptible. As you have more and more async operations, this guarantee gets pretty weak (if you have more than one pending async task and the current task yields, which one will run next?) and you have to start employing the usual locking mechanisms to ensure correctness.
[ Parent
| on HN ]
Re:Go-like channels in 10 lines of JavaScript
by eurasiantiger on Sunday February 05, 2023 @03:23AM
(#34662994)
From experience, it is a strong enough guarantee to prevent many race conditions.