2 ms·
JavaScript uses non-preemptive multitasking. It's trivial to write locking primitives. Indeed there are already many: https://www.npmjs.com/search?q=mutex https
by tlrobinson 7y ago
JavaScript uses non-preemptive multitasking. It's trivial to write locking primitives. Indeed there are already many: https://www.npmjs.com/search?q=mutex https://www.npmjs.com/search?q=mutex
You could even have a method decorator (https://github.com/tc39/proposal-decorators https://github.com/tc39/proposal-decorators) that emulates Java's "synchronized" keyword.