Reputation: 17282
What is difference between multiprocessing.Event
and multiprocessing.managers.SyncManager.Event
. When do I use each? Why two different objects exist?
Same question for other similar objects existing in multiprocessing
directly and also in Manager
(Lock
, etc.)
Upvotes: 16
Views: 5215
Reputation: 25446
multiprocessing.Manager is essentially a specialised process that will create instances of multiprocessing's synchronisation primitives on demand in its own address space, and let you access them through RPC proxies. The primitives behave the same, and they have the added flexibility of being accessible from remote hosts (using TCP in the remote case).
Upvotes: 1
Reputation: 17282
Unfortunately, the only given answer is not very correct and others wasn't given.
I looked it up my own, and found that multiprocessing.Event
can be used to synch between processes, it's completely alright.
Event
and other objects from multiprocessing.Manager
exist to be able to synchronize things between processes that runs on different machines via sockets under the hood. They also can be used synchronize on single machine, but less efficient for this than just using synch objects from multiprocessing.synchronize
(like Event
and Lock
and others)
Upvotes: 14