ID EN
Multiprocessing

Value

Python 3.11

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.

Syntax

PYTHON
multiprocessing.Value(typecode_or_type, *args, lock=True)

Examples

Example 1
PYTHON
counter.value += 1
Example 2
PYTHON
with counter.get_lock():
    counter.value += 1

See Also

ctypes Value array Lock RLock