Implementing Mutual Exclusion for AJAX
Subject:   Still a race-condition?
Date:   2007-08-30 11:18:28
From:   polyglot
Response to: Still a race-condition?

Because it is hard to find any promises from JavaScript implementors around these sorts of issues, it seems that no solution would be provable, so I went with something practical.
For those worried that the increment operator is not atomic, one could replace it with a large random large number which would make the odds of failure small (e.g. one in 4 billion) and known.
I guess it depends on which operation one has the least paranoia about. :-)