Int API: ¶
Module shared_atomic
-
int provide atomic operations, the int takes 8 bytes :attributes
reference: readonly pointer to the integer
value: read/write value of the integer
mode: readonly ‘s’ for single process, ‘m’ for multiprocessing, on windows platform, only singleprocessing is supported
windows_unix_compatibility: readonly whether the source code should be compatible with windows x64
constructor of atomic_int :attributes
value: read/write value of the integer
mode: ‘s’ or ‘singleprocessing’ for single process, ‘m’ or ‘multiprocessing’ for multiprocessing
windows_unix_compatibility: whether the source code should be compatible with windows x64
-
getter
- Returns
-
value
-
increment and fetch atomically
- Parameters
-
n – data to add
- Returns
-
sum of the 2 values
-
bitwise AND and fetch the result atomically
- Parameters
-
n – data to AND
- Returns
-
resulted value
-
Compare and set atomically. This compares the contents of self with the contents of e. If equal, the operation is a read-modify-write operation that writes n into self. If they are not equal, the operation is a read and the current contents of self are written into e.
- Parameters
-
-
e – atomic_int e
-
n – value to be set
-
- Returns
-
whether the contents of v and contents of e is the same
-
Compare and set atomically. This compares the contents of self with the contents of n. If equal, the operation is a read-modify-write operation that writes e into self. If they are not equal, no operation will be taken.
- Parameters
-
-
e – The exchange value
-
n – The value to compare to
-
- Returns
-
initial value
-
fetch and increment atomically
- Parameters
-
n – data to add
- Returns
-
original value in v
-
fetch then bitwise AND atomically
- Parameters
-
n – data to AND
- Returns
-
the result
-
fetch then bitwise NAND atomically
- Parameters
-
n – data to NAND
- Returns
-
the result
-
fetch then bitwise OR atomically
- Parameters
-
n – data to OR
- Returns
-
the result
-
fetch and subtract atomically
- Parameters
-
n – data to subtract
- Returns
-
original value in v
-
fetch then bitwise XOR atomically
- Parameters
-
n – data to XOR
- Returns
-
the result
-
get and set atomically
- Parameters
-
n – value to set
- Returns
-
original value
-
bitwise NAND and fetch the result atomically
- Parameters
-
n – data to NAND
- Returns
-
resulted value
-
bitwise XOR and fetch the result atomically
- Parameters
-
n – data to OR
- Returns
-
resulted value
-
value exchange between 3 atomic_ints in 2 groups atomically, store n in v after store v in r
- Parameters
-
-
n – atomic_int of n
-
r – atomic_int of r
-
- Returns
-
None
-
Store value atomically
- Parameters
-
n – atomic_int from which value is from
- Returns
-
None
-
sub and fetch atomically
- Parameters
-
n – data to subtract
- Returns
-
difference of the 2 values
-
bitwise XOR and fetch the result atomically
- Parameters
-
n – data to XOR
- Returns
-
resulted value
-
setter
- Parameters
-
value – value to set
- Returns
-
None
-
get and set for the integer number
-