Python's Multiprocessing.Pool Process Global Scope Problem
How can I change a global variable STOP to True? As I understand, the problem is with the scope of other processes, but I don't know how to realize it. from multiprocessing import
Solution 1:
...
STOP = Value('b', 0)
...
if x == 19:
STOP.value = 1
...
while not STOP.value:
...
Unlike multithreading, each process executes in a completely separate environment. New processes copy the state of the current process, but from then on they are independent - like books that come out of the printing press the same, but if you write into one book, the other books of the same title do not get your scribbles. You need the magic that will "share the scribbles" - the magic that is implemented by the various classes of multiprocessing
.
Post a Comment for "Python's Multiprocessing.Pool Process Global Scope Problem"