>>> import multiprocessing
>>> multiprocessing.Manager().Lock()
<thread.lock object at 0x7f64f7736290>
>>> type(multiprocessing.Lock())
<class 'multiprocessing.synchronize.Lock'>
Why the object produced by a manager is a thread.lock
and not a multiprocessing.synchronize.Lock
as it would be expected from a multiprocessing
object?
multiprocessing.Lock
andthreading.Lock
that may be significant. I guess you'd normally usemultiprocessing.Lock()
unless you absolutely must have athreading.Lock()
object, at which point the manager makes sure it is synchronised across processes for you? – Turvesmultiprocessing.Lock
object? You don't need to manage that object, it already is multiprocessing-aware. – Turves