Why Python Multiprocessing Manager Produce Threading Locks?
Solution 1:
Managed objects are always proxies; the goal of the manager is to make non-multiprocessing-aware objects into multiprocessing aware.
There is no point in doing this for multiprocessing.Lock()
objects; these are implemented using semaphores and are fully multiprocessing capable without assistance.
threading.Lock
on the other hand is not multiprocessing aware; there are some differences between threading.Lock()
objects and multiprocessing.Lock()
; the latter supports a timeout when acquiring a lock, for example.
Solution 2:
It is certainly not expected since the documentation clearly states that Lock()
Create a shared
threading.Lock
object and return a proxy for it.
As to why it returns a threading.Lock instead of a multiprocessing object is a different story I unfortunately can't answer.
Post a Comment for "Why Python Multiprocessing Manager Produce Threading Locks?"