4 ms·
Race conditions are in the nature of concurrent code. Not just parallel code. Take go, use gomaxprocs and set it to 1. Spawn a bunch of goroutines that share m
by aaomidi 6y ago
Race conditions are in the nature of concurrent code. Not just parallel code.
Take go, use gomaxprocs and set it to 1. Spawn a bunch of goroutines that share memory. And easily you'll have race conditions if you're not careful.
- piterrro 6y agoI didnt say race conditions are impossible in Nodejs. Just highlighted that good program engineering is enough to avoid it and programmers should do that in the first place.
- aaomidi 6y agoSure but at the same time there is a reason synchronization primitives exist. Readability of code > everything else.
- piterrro 6y agoNodejs doesn't have synchronization primitives, just because you use Promise and assign it to variable "mutex" doesn't make it any more real
- deleted 6y ago[deleted]
- dboreham 6y agoIt would be better if I had the time today to refute this in detail, because it's important that others reading this thread know this assertion is false, but...it's false.
- cphoover 6y agoAgreed Over the past 10 years, I've done async code to coordinate lots of different concurrent tasks in JS, never once needed a the use of a mutex.