Return a ctypes object allocated from shared memory. By default the return value is actually a synchronized wrapper for the object. The object itself can be accessed via the value attribute of a Value.
multiprocessing.Value(typecode_or_type, *args, lock=True)
counter.value += 1
with counter.get_lock():
counter.value += 1