javascript - Thread-safe array deletions -


i know 1 can either splice item out of array, or delete delete. former approach can cause concurrency problems, e.g. if 1 thread walking on array while has shifted or spliced. delete doesn't have issue if foreach used on array, since foreach walk on holes in array.

however, array can't keep growing forever , necessitate sweeping, potentially causing same issue in case of splice. sounds need locking, i'd amused if javascript had facilities it. thoughts?

no, can't have concurrency problem javascript isn't multithreaded. if use webworkers won't have problems no data shared (workers communicate passing messages). in node.js script isn't multi-threaded.

so use splice, there no need lock array.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -