def RunAmplifierFeedbackSetup(self, programData, amplifierSettings): runningComputers = [] computers = [] nextValue = 0 for index, setting in enumerate(amplifierSettings): inputOutputEvents = (threading.Event(), threading.Event()) c = Computer(programData, True, [setting, nextValue], inputOutputEvents) t = threading.Thread(target=threadStartFunc, args=( c, index, )) t.start() computers.append(c) runningComputers.append([c, t]) nextValue = c.GetHighestOutput() loop = 5 while (loop > 0): for index in range(len(runningComputers)): c, t = runningComputers[index] if (c is None): # in theory each amplifier stops in linear succession assert (0 == 1) continue c.AddInput(nextValue) if (c.GetState() == 0): nextValue = c.GetLastOutput() runningComputers[index] = None loop = loop - 1 else: nextValue = c.GetHighestOutput() return nextValue