3 ms·
And do you always know beyond any reasonable doubt that your code will be single-threaded for all time? Because the moment this changes, you're in for a world o
by Tainnor 2y ago
And do you always know beyond any reasonable doubt that your code will be single-threaded for all time? Because the moment this changes, you're in for a world of pain.
- christophilus 2y agoIf JavaScript ever gets real shared memory multithreading, it will be opt in so that the entire web doesn’t break. So, yes.
- Tainnor 2y agoIf the discussion here is meant to be solely about JavaScript, then I'll happily consider all my comments in this thread to be obsolete, since I don't have particularly strong opinions about that language since I don't use it a lot. I was under the impression that many people here were discussing the usage of global variables more generally, though.
- rurban 2y agoWrapping the globals into to a struct context #ifdef MULTI-THREADED and adding this ctx for each call as first call is a matter of minutes. I've done this multiple times. Much worse is protecting concurrent writes, eg to an object or hash table