Если вы используете multiprocessing.Value - к самому объекту можно получить доступ через атрибут value
.
Вот примитивный пример:
from multiprocessing import Process, Value, Queue, cpu_count, current_process
def handle(v):
val = v.value
if bool(val) is True:
print('process {} is using value {}'.format(current_process().name, val))
else:
v.value = 1
print('process {} changed value {} to {}'
.format(current_process().name, val, v.value))
if __name__ == '__main__':
v = Value('i', 0)
processes = [Process(target=handle, args=(v,)) for _ in range(cpu_count())]
for p in processes:
p.start()
for p in processes:
p.join()
print(v, v.value)
Выход:
process Process-1 changed value 0 to 1
process Process-2 is using value 1
process Process-3 is using value 1
process Process-4 is using value 1
process Process-5 is using value 1
process Process-6 is using value 1
process Process-7 is using value 1
process Process-8 is using value 1
process Process-9 is using value 1
process Process-10 is using value 1
process Process-11 is using value 1
process Process-12 is using value 1
<Synchronized wrapper for c_int(1)> 1