properly synchronize threads in InterpreterProcess