Multithreading failed in for loop which updates source position

I have a for loop in my main program which updates detector geometry and source position. I modified the B1example and intend to use
"
B1ActionInitialization* act = new B1ActionInitialization(src_posi);
runManager->SetUserInitialization(act);
"
to update the source position in each loop. I found if I use single thread, the program can run properly, however, if I use multithread runManager there will be segment fault. The runManager->SetUserInitialization() command caused the problem.

I am wondering if anyone can provide comments on how to use multithread runManager to update source position in each loop? I am using “G4ParticleGun” as my source class since I need to set customized ParticleMomentumDirection, energy distribution and source position at each beamOn time (each loop). Thanks!