See: https://julialang.org/blog/2023/07/PSA-dont-use-threadid/ This is unsafe now that julia has the ability to add and remove threads dynamically; you may end up on a threadid that is out-of-bounds on the vector.