class multiprocessing.managers.SyncManager
A subclass of BaseManager which can be used for the synchronization of processes. Objects of this type are returned by multiprocessing.Manager().
It also supports creation of shared lists and dictionaries.
-
Barrier(parties[, action[, timeout]]) -
Create a shared
threading.Barrierobject and return a proxy for it.New in version 3.3.
-
BoundedSemaphore([value]) -
Create a shared
threading.BoundedSemaphoreobject and return a proxy for it.
-
Condition([lock]) -
Create a shared
threading.Conditionobject and return a proxy for it.If lock is supplied then it should be a proxy for a
threading.Lockorthreading.RLockobject.Changed in version 3.3: The
wait_for()method was added.
-
Event() -
Create a shared
threading.Eventobject and return a proxy for it.
-
Lock() -
Create a shared
threading.Lockobject and return a proxy for it.
-
Namespace() -
Create a shared
Namespaceobject and return a proxy for it.
-
Queue([maxsize]) -
Create a shared
queue.Queueobject and return a proxy for it.
-
RLock() -
Create a shared
threading.RLockobject and return a proxy for it.
-
Semaphore([value]) -
Create a shared
threading.Semaphoreobject and return a proxy for it.
-
Array(typecode, sequence) -
Create an array and return a proxy for it.
-
Value(typecode, value) -
Create an object with a writable
valueattribute and return a proxy for it.
-
dict() -
dict(mapping) -
dict(sequence) -
Create a shared
dictobject and return a proxy for it.
-
list() -
list(sequence) -
Create a shared
listobject and return a proxy for it.
Note
Modifications to mutable values or items in dict and list proxies will not be propagated through the manager, because the proxy has no way of knowing when its values or items are modified. To modify such an item, you can re-assign the modified object to the container proxy:
# create a list proxy and append a mutable object (a dictionary)
lproxy = manager.list()
lproxy.append({})
# now mutate the dictionary
d = lproxy[0]
d['a'] = 1
d['b'] = 2
# at this point, the changes to d are not yet synced, but by
# reassigning the dictionary, the proxy is notified of the change
lproxy[0] = d
Please login to continue.