By pulling the re-order portion of the code into its own structure, and a struct as that as well, we discovered that the actual code was going on recursively, so reading / modifying the arrays without any form of locking. So we use DispatchQueue sync() now to protect this state. I think the speed will be a bit slower, but overall the code should be safer.
By pulling the re-order portion of the code into its own structure, and a struct as that as well, we discovered that the actual code was going on recursively, so reading / modifying the arrays without any form of locking. So we use DispatchQueue sync() now to protect this state. I think the speed will be a bit slower, but overall the code should be safer.