This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lorenzo Persichetti
Recipients Lorenzo Persichetti, docs@python, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-01-19.21:50:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547934632.93.0.223661167179.issue35786@roundup.psfhosted.org>
In-reply-to
Content
According to the documentation of the multiprocessing.Value() class available here https://docs.python.org/3.6/library/multiprocessing.html#multiprocessing.Value

Operations like += which involve a read and write are not atomic. So if, for instance, you want to atomically increment a shared value it is insufficient to just do

counter.value += 1
Assuming the associated lock is recursive (which it is by default) you can instead do

with counter.get_lock():
    counter.value += 1

What happens is that when running the following snippet

import multiprocessing
manager = multiprocessing.Manager()
value = manager.Value('i', 0)
value.get_lock()

the result is 
AttributeError: 'ValueProxy' object has no attribute 'get_lock'
History
Date User Action Args
2019-01-19 21:50:36Lorenzo Persichettisetrecipients: + Lorenzo Persichetti, paul.moore, tim.golden, docs@python, zach.ware, steve.dower
2019-01-19 21:50:32Lorenzo Persichettisetmessageid: <1547934632.93.0.223661167179.issue35786@roundup.psfhosted.org>
2019-01-19 21:50:32Lorenzo Persichettilinkissue35786 messages
2019-01-19 21:50:32Lorenzo Persichetticreate