from multiprocessing import Process def C(): i = 0 while True: i += 1 yield i c = C() def F(j): print(j, c.__next__()) for j in range(5): Process(target = F, args = (j,)).start()
How to make subprocesses use one C () generator? With the next generation of the value, not the initial one. For example, this code will produce 0 - 1, 1 - 1, 2 - 1 ... And the implementation only from this: 0 - 1, 1 - 2, 2 - 3 ... Or subprocesses copy the object generator and it does not get around this way ?