4 ms·
You're right that this example is better solved without mutexes, but it's good that the article is introducing the concept to NodeJS devs who may not be used to
by hrishi 6y ago
You're right that this example is better solved without mutexes, but it's good that the article is introducing the concept to NodeJS devs who may not be used to it. Heck, I used mutexes extensively for years in C code and even I didn't know they were an option.
That said, mutexes are also not always wrong. Compare-and-swap is good, ensuring atomicity is good, but sometimes a mutex is what you need, especially if you're fixing legacy code with concurrency issues.