I’ve got an asynchronous application, meaning that at any given time there can be N events. Is there a known algorithm for doing mutual exclusion for N threads, without hardcoding each thread to have an ID?
I’ve got an asynchronous application, meaning that at any given time there can be
Share
I don’t think Javascript per se has object locking – because Javascript is basically single-threaded. You might be able to find a library or implementation that runs several threads of Javascript code – but are they all running in the same variable-space? They will need to communicate with each other somehow.
Assuming your multiple threads can share a static
mutexvariable somehow, and insofar as you assume ‘++‘ is considered an atomic operation for the system that is doing your threading, how about this?