Will my variable be modified in a `do` block? Very subtle to anticipate

This is actually one of the few things I strongly dislike with julia. If you happen to have a variable a outside the @threads loop, and use a inside, all the parallel tasks share the same a. It’s relatively harmless if a is only read inside the loop, and quite nice for setting up constants and whatever, but it is devastating if a is used as a temporary variable which is assigned to in the parallel tasks.

1 Like