4 ms·
well without atomic access your state would be wrong. there are languages that allow stuff like that, but if you do it you can still have the wrong number. i.e.
by merb 5y ago
well without atomic access your state would be wrong. there are languages that allow stuff like that, but if you do it you can still have the wrong number. i.e. in c# something like you wrote is possible but when getting multiple requests, the number might be wrong at the end.
you always have some tradeoffs because in your case when you would run it with a multi threaded js engine your variable would be as broken as the c# one.
that's why java does not allow it by default to modify a variable inside a thread that is declared outside.