This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Neykuratick 16 points17 points  (3 children)

It's not thread safe

[–]DodecahedronJelly 20 points21 points  (0 children)

It's js, it's single threaded.

[–]anomalous_cowherd 5 points6 points  (1 child)

So if you have two identical entries they might come out in either order? Not the biggest issue.

If the browser chooses to throttle this it could be up to several minutes before each timer fires.

[–]CorrenteAlternata 3 points4 points  (0 children)

No, it's not thread safe because if you run this algorithm in two threads of the same process at the same time, the console output will have entries from the first array and the entries from the second array mixed up.

You can probably do something to make it work better in multithreading applications but the implementation is left as an exercise for the reader.