Locking properties of AbstractArrays

There are many different AbstractArray and they have different thread safety behavior.

In general though. x_temp[i] += is NEVER thread safe if two thread access the same i. It can be thread safe if you can guarantee i are all different for different threads but not if different indices belongs to the same memory location which is the case for BitArray

Performance wise, you should make sure each thread work on different memory. What you are doing should be fine.

Note that I dont think LLVM has enough information to hoist the memory access to x_temp in convolve! it’ll be better if you do xtempi = x_temp[i] before the loop, xtempi += in the loop and x_temp[i] = xtempi after the loop. This is not thread specific.