2 ms·
It's a great question. JS is single threaded (modulo web workers), which eliminates an entire class of race conditions: data races. That means mutices kan be sk
by klabb3 5y ago
It's a great question. JS is single threaded (modulo web workers), which eliminates an entire class of race conditions: data races. That means mutices kan be skipped and channels can be replaced with a reqular fifo queue.
Async doesn't change any of this, and is mostly syntax sugar for callbacks. However, there are of course logical race conditions so when you use async you must be aware that the entire world can have changed after an await.