Procedure Oriented API:¶
Module shared_atomic.atomic_object on Linux and macOS
Increment and fetch atomically
- Parameters
array – target array to change.
n – bytes will be added to the array.
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the contents of resulted bytearray
Bitwise and and then fetch atomically
- Parameters
array – target array to change.
n – the other operands of AND operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Compare and set atomically, this compares the contents of j with the contents of i. 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 j are written into i.
- Parameters
array – target array to change.
i – the string to compare
j – the string to be compared with
data – another bytes to be ready to self if comparision return True
- Returns
if self is equal to i return True, else return False
Compare and set atomically,This compares the contents of self with the contents of i. 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 itself are written into i.
- Parameters
array – target array to change.
i – The exchange value
n – The value to compare to
trim – whether the returned bytes should be trimmed of tailing b’\0’
- Returns
Original value
fetch and increment atomically
- Parameters
array – target array to change.
n – the bytes will be added to the array
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise AND atomically
- Parameters
array – target array to change.
n – the other operands of AND operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise NAND atomically
- Parameters
array – target array to change.
n – the other operands of XOR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise OR atomically
- Parameters
array – target array to change.
n – the other operands of OR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
fetch and decrement atomically
- Parameters
array – target array to change.
n – the bytes will be substracted from the array
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise XOR atomically
- Parameters
array – target array to change.
n – the other operands of XOR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Get and set atomically
- Parameters
array – target array to change.
data – new data
trim – if True, the leading b’\0’ would be trimmed, by default: True
- Returns
the original bytes
Get all the bytes from the bytearray atomically
- Parameters
array – target array.
trim – if True, the leading b’\0’ would be trimmed, by default: True
- Returns
all the bytes in the bytearray
Get the integer representation from the bytearray, the whole array would be treated as a large integer
- Parameters
array – target array.
- Returns
the integer representation
Bitwise nand and then fetch atomically
- Parameters
array – target array to change.
n – the other operands of XOR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Bitwise or and then fetch atomically
- Parameters
array – target array to change.
n – the other operands of OR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Set the bytes for the bytearray,
- Parameters
array – target array.
data – bytes to set the data.
- Returns
None
Value exchange between 3 pointers in 2 groups atomically, the initial_length field will be updated but not atomically. store i in n after store n in j
- Parameters
n – one atomic_string
i – one atomic_string
j – another atomic_string
- Returns
None
Set the bytes for the bytearray from another bytearray,
- Parameters
n – target array.
i – source array.
- Returns
None
Decrement and fetch atomically
- Parameters
array – target array to change.
n – bytes will be subtracted from the array.
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the contents of resulted bytearray
Bitwise xor and then fetch atomically
- Parameters
array – target array to change.
n – the other operands of XOR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Compare and set atomically. This compares the contents of a with the contents of b. 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 a are written into b.
- Parameters
a – atomic_bool object
b – atomic_bool object
n – the boolean value to set from
- Returns
the original boolean value
Compare and swap atomically, This compares the contents of atomic_bool object a 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 is performed.
- Parameters
a – the atomic_bool object
e – The exchange value
n – the value to be compared with
- Returns
the initial value
get the contents of atomic_bool object atomically.
- Parameters
boolean – atomic_bool object
- Returns
the boolean value
get and set contents of atomic_bool object atomically.
- Parameters
a – atomic_bool object
n – the boolean value to set from
- Returns
the original boolean value
set the contents of atomic_bool object atomically.
- Parameters
boolean – atomic_bool object
n – the boolean value to set from
- Returns
None
value exchange between 3 atomic_bools in 2 groups atomically, store b in a after store a in n
- Parameters
a – atomic_bool object
b – atomic_bool object
n – atomic_bool object
- Returns
None
set the contents of atomic_bool object a atomically from another atomic_bool object b
- Parameters
a – atomic_bool object
b – atomic_bool object
- Returns
None
get the contents of atomic_float object atomically.
- Parameters
a – atomic_float object
- Returns
the float value
set the contents of atomic_float object atomically.
- Parameters
a – atomic_float object
n – the float value to set from
- Returns
None
set the contents of atomic_float object a atomically from another atomic_float object b
- Parameters
v – atomic_float object
n – atomic_float object
- Returns
None
increment and fetch atomically
- Parameters
integer – the atomic_int
n – the integer value
- Returns
sum of the 2 values
Bitwise AND and fetch atomically
- Parameters
integer – the atomic_int
n – data to AND
- Returns
the result value
Compare and set atomically. This compares the contents of integer with the contents of e. If equal, the operation is a read-modify-write operation that writes n into integer. If they are not equal, the operation is a read and the current contents of integer are written into e.
- Parameters
integer – atomic_int object
e – atomic_int object
n – the integer value to set from
- Returns
if integer is equal to e return True, else return False
Compare and swap atomically, This compares the contents of atomic_int integer with the contents of n. If equal, the operation is a read-modify-write operation that writes e into integer. If they are not equal, No operation is performed.
- Parameters
integer – the atomic_int
e – the integer value
n – the integer value
- Returns
the initial value
increment and fetch atomically
- Parameters
integer – the atomic_int
n – data to add
- Returns
the initial value
fetch then bitwise AND atomically
- Parameters
integer – the atomic_int
n – data to AND
- Returns
the initial value
fetch then bitwise NAND atomically
- Parameters
integer – the atomic_int
n – data to NAND
- Returns
the initial value
fetch then bitwise OR atomically
- Parameters
integer – the atomic_int
n – data to OR
- Returns
the initial value
subtract and fetch atomically
- Parameters
integer – the atomic_int
n – data to subtract
- Returns
the initial value
fetch then bitwise XOR atomically
- Parameters
integer – the atomic_int
n – data to XOR
- Returns
the initial value
get the contents of atomic_int atomically.
- Parameters
integer – the atomic_int to get
- Returns
the int value
get and set contents of atomic_int atomically.
- Parameters
integer – the atomic_int
n – the integer value to set from
- Returns
the original int value
Bitwise NAND and fetch atomically
- Parameters
integer – the atomic_int
n – data to NAND
- Returns
the result value
Bitwise OR and fetch atomically
- Parameters
integer – the atomic_int
n – data to OR
- Returns
the result value
set the contents of atomic_int atomically.
- Parameters
integer – the atomic_int to set
n – the integer value to set from
- Returns
None
value exchange between 3 atomic_ints in 2 groups atomically, store n in integer after store integer in r.
- Parameters
integer – the atomic_int integer
n – the atomic_int n
r – the atomic_int r
- Returns
None
Store value atomically.
- Parameters
integer – the atomic_int to set
n – the atomic_int to set from
- Returns
None
sub and fetch atomically
- Parameters
integer – the atomic_int
n – the integer value
- Returns
sum of the 2 values
Bitwise XOR and fetch atomically
- Parameters
integer – the atomic_int
n – data to XOR
- Returns
the result value
Compare and set atomically. This compares the contents of atomic_list j with the contents of i. If equal, the operation is a read-modify-write operation that writes data into integer. If they are not equal, the operation is a read and the current contents of j are written into i.
- Parameters
j – atomic_list object
i – atomic_list object
data – atomic_list object
- Returns
if j is equal to i return True, else return False
Compare and set atomically,This compares the contents of input_list with the contents of i. If equal, the operation is a read-modify-write operation that writes n into input_list. If they are not equal, no action will be taken.
- Parameters
input_list – target list.
i – The exchange value
n – The value to compare to
- Returns
Original value
Get and set atomically
- Parameters
input_list – target list.
data – new data list
- Returns
the original list
Get the whole integer representation from the list, the whole set would be treated as a large integer
- Parameters
input_list – target list.
- Returns
the integer representation
Get the list atomically
- Parameters
input_list – target list.
- Returns
the list
Set the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
input_list – target list.
- Returns
None
Set the value in the list, if the new data is longer than the original size of the list. it will expand the set accordingly which would lose atomicity. the size of the set can be checked with list.size
- Parameters
input_list – target list.
data – input list
- Returns
None
Value exchange between 3 atomic_list in 2 groups atomically, the initial_length field will be updated but not atomically. store i in n after store n in j
- Parameters
n – one atomic_list
i – one atomic_list
j – one atomic_list
- Returns
None
Atomically store contents from another list to this list, if the other set is different with this one in size , or the other set is different with this one in encoding , the function will fail.
- Parameters
n – the atomic_list to set
i – the atomic_list to set from
- Returns
None
Compare and set atomically. This compares the contents of atomic_set j with the contents of i. If equal, the operation is a read-modify-write operation that writes data into integer. If they are not equal, the operation is a read and the current contents of j are written into i.
- Parameters
intput_set – target set to change.
j – atomic_set object
i – atomic_set object
data – atomic_set object
- Returns
if j is equal to i return True, else return False
Compare and swap atomically, This compares the contents of self with the contents of n. If equal, the operation is a read-modify-write operation that writes n into self. If they are not equal, No operation is performed.
- Parameters
intput_set – target set to change.
i – the value to set to
n – The value to be compared with
- Returns
the original set
Get and set atomically
- Parameters
intput_set – target set to change.
data – new data set
- Returns
the original set
Get the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
intput_set – target set.
- Returns
the integer representation
Get the set atomically
- Parameters
intput_set – target set.
- Returns
the set
Set the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
intput_set – target set to change.
integer – integer representation of the new value.
- Returns
None
Set the value in the set, if the new data is longer than the original size of the set. it will expand the set accordingly which would lose atomicity. the size of the set can be checked with set.size
- Parameters
intput_set – target set to change.
data – input set
- Returns
None
Value exchange between 3 pointers in 2 groups atomically, the initial_length field will be updated but not atomically. store i in n after store n in j
- Parameters
n – one atomic_set
i – one atomic_set
j – one atomic_set
- Returns
None
Atomically store contents from another set to this set, if the other set is different with this one in size, or the other set is different with this one in encoding, the function will fail.
- Parameters
n – the atomic_set to set
i – the atomic_set to set from
- Returns
None
increment and fetch atomically
- Parameters
memory – target shared memory.
value – data to add
offset – the offset inside the shared memory starting from 0 you need to add,
- Returns
sum of the 2 values
bitwise AND and fetch the result atomically
- Parameters
memory – target shared memory.
value – data to AND
offset – the offset inside the shared memory starting from 0 you need to AND with,
- Returns
the result value
Compare and set atomically. This compares the contents of shared_memory2 at offset2 with the contents of memory at offset. If equal, the operation is a read-modify-write operation that writes bytes parameter value into self. If they are not equal, the operation is a read and the current contents of memory are written into shared_memory2.
- Parameters
memory – target shared memory.
shared_memory2 – the other shared memory from which the data is from
value – the value to write to the shared memory,
offset – the offset inside the shared memory starting from 0 you need to set,
offset2 – the offset2 inside the shared memory 2 starting from 0 you need to get,
- Returns
whether the contents of memory and contents of shared_memory2 is the same
Compare and set atomically. This compares the contents of n with the contents of memory at offset. If equal, the operation is a read-modify-write operation that writes bytes parameter value into memory. If they are not equal, no operation will be taken.
- Parameters
memory – target shared memory.
i – exchange value
n – The value to be compared with
offset – the offset inside the shared memory starting from 0 you need to set,
- Returns
the original value at offset
Compare and set atomically. This compares the contents of another atomic_object with the contents of memory at offset. If equal, the operation is a read-modify-write operation that writes bytes parameter value into memory. If they are not equal, the operation is a read and the current contents of self are written into object2.
- Parameters
memory – target shared memory.
object2 – the other atomic object from which the data is compared with
offset – the offset inside the shared memory starting from 0 you need to compare and set,
value – value to be set
- Returns
whether the contents of memory and contents of object2 is the same
fetch and increment atomically
- Parameters
memory – target shared memory.
value – data to add
offset – the offset inside the shared memory starting from 0 you need to add to,
- Returns
original value
fetch then bitwise AND atomically
- Parameters
memory – target shared memory.
value – value to AND to
offset – the offset inside the shared memory starting from 0 you need to AND to,
- Returns
original value
fetch then bitwise NAND atomically
- Parameters
memory – target shared memory.
value – value to NAND with
offset – the offset inside the shared memory starting from 0 you need to NAND with,
- Returns
original value
fetch then bitwise OR atomically
- Parameters
memory – target shared memory.
value – value to OR with
offset – the offset inside the shared memory starting from 0 you need to OR with,
- Returns
original value
fetch and substract atomically
- Parameters
memory – target shared memory.
value – data to sub
offset – the offset inside the shared memory starting from 0 you need to substract from,
- Returns
original value
fetch then bitwise XOR atomically
- Parameters
memory – target shared memory.
value – value to XOR with
offset – the offset inside the shared memory starting from 0 you need to XOR with,
- Returns
original value
Atomically get the bytes at specific offset given specific length
- Parameters
memory – target shared memory.
offset – the offset inside the shared memory starting from 0
length – the length of bytes should be retrieved
- Returns
bytes at specific offset.
Atomically set the bytes at specific offset given specific length
- Parameters
memory – target shared memory.
value – new value in bytes
offset – the offset inside the shared memory starting from 0, including the operation length
- Returns
bytes at specific offset previously.
bitwise NAND and fetch the result atomically
- Parameters
memory – target shared memory.
value – data to NAND
offset – the offset inside the shared memory starting from 0 you need to NAND with,
- Returns
the result value
bitwise OR and fetch the result atomically
- Parameters
memory – target shared memory.
value – data to OR
offset – the offset inside the shared memory starting from 0 you need to OR with,
- Returns
the result value
Atomically set the data at specific offset given specific length
- Parameters
memory – target shared memory.
shared_memory2 – the other shared memory from which the data is from
offset – the offset inside the shared memory starting from 0 you need to set,
offset2 – the offset inside the shared memory from the data you want,
length – the length of bytes should be set in the shared memory and get the data from the shared memory 2, only 1,2,4 and 8 are supported
- Returns
None
Atomically set the data at specific offset given specific length, if object2 is in variable length, and object2 is changing the size at the same time, the method will not be atomic, otherwise, the operation is atomic.
- Parameters
memory – target shared memory.
object2 – the other atomic object from which the data is from
offset – the offset inside the shared memory starting from 0 you need to set
- Returns
None
increment and fetch atomically
- Parameters
memory – target shared memory.
value – data to sub
offset – the offset inside the shared memory starting from 0 you need to add,
- Returns
sum of the 2 values
bitwise XOR and fetch the result atomically
- Parameters
memory – target shared memory.
value – data to XOR
offset – the offset inside the shared memory starting from 0 you need to XOR with,
- Returns
the result value
Compare and set atomically, this compares the contents of j with the contents of i. If equal, the operation is a read-modify-write operation that writes n into j. If they are not equal, the operation is a read and the current contents of j are written into i.
- Parameters
j – the string to be compared
i – the string to be compared with
n – another string to be write to j if comparision return True
- Returns
if j is equal to n return True, else return False
Compare and swap atomically, This compares the contents in atomic_string string with the contents of n. If equal, the operation is a read-modify-write operation that writes i into self. If they are not equal, No operation is performed.
- Parameters
string – target string.
i – The exchange value
n – the value to be compared with
- Returns
the original string
Get and set atomically
- Parameters
string – target string.
data – new data
- Returns
the original string
Get all the bytes from the string atomically
- Parameters
string – target string.
- Returns
the full string
Set the bytes value in the string, if the new data is longer than the original size of the string. it will expand the string accordingly which would lose atomicity. the size of the string can be check with self.size
- Parameters
string – target string.
data – value to set to
- Returns
None
Value exchange between 3 atomic_strings in 2 groups atomically, the initial_length field will be updated but not atomically. store i in n after store n in j
- Parameters
n – one atomic_string
i – one atomic_string
j – another atomic_string
- Returns
None
Atomically set the data in atomic_string n from atomic_string i
- Parameters
n – target atomic_string.
i – atomic_string from which the data is from
- Returns
None
increment and fetch atomically
- Parameters
integer – the atomic_uint
n – the integer value
- Returns
sum of the 2 values
Bitwise AND and fetch atomically
- Parameters
integer – the atomic_uint
n – data to AND
- Returns
the result value
Compare and set atomically. This compares the contents of integer with the contents of e. If equal, the operation is a read-modify-write operation that writes n into integer. If they are not equal, the operation is a read and the current contents of integer are written into e.
- Parameters
integer – atomic_uint object
e – atomic_uint object
n – the integer value to set from
- Returns
if integer is equal to e return True, else return False
Compare and swap atomically, This compares the contents of atomic_uint integer with the contents of n. If equal, the operation is a read-modify-write operation that writes e into integer. If they are not equal, No operation is performed.
- Parameters
integer – the atomic_uint
e – the integer value
n – the integer value
- Returns
the initial value
increment and fetch atomically
- Parameters
integer – the atomic_uint
n – data to add
- Returns
the initial value
fetch then bitwise AND atomically
- Parameters
integer – the atomic_uint
n – data to AND
- Returns
the initial value
fetch then bitwise NAND atomically
- Parameters
integer – the atomic_uint
n – data to NAND
- Returns
the initial value
fetch then bitwise OR atomically
- Parameters
integer – the atomic_uint
n – data to OR
- Returns
the initial value
subtract and fetch atomically
- Parameters
integer – the atomic_uint
n – data to subtract
- Returns
the initial value
fetch then bitwise XOR atomically
- Parameters
integer – the atomic_uint
n – data to XOR
- Returns
the initial value
get the contents of atomic_uint atomically.
- Parameters
integer – the atomic_uint to get
- Returns
the int value
get and set contents of atomic_uint atomically.
- Parameters
integer – the atomic_uint
n – the integer value to set from
- Returns
the original int value
Bitwise NAND and fetch atomically
- Parameters
integer – the atomic_uint
n – data to NAND
- Returns
the result value
Bitwise OR and fetch atomically
- Parameters
integer – the atomic_uint
n – data to OR
- Returns
the result value
set the contents of atomic_uint atomically.
- Parameters
integer – the atomic_uint to set
n – the integer value to set from
- Returns
None
value exchange between 3 atomic_uint in 2 groups atomically, store n in integer after store integer in r.
- Parameters
integer – the atomic_uint integer
n – the atomic_uint n
r – the atomic_uint r
- Returns
None
Store value atomically.
- Parameters
integer – the atomic_uint to set
n – the atomic_uint to set from
- Returns
None
sub and fetch atomically
- Parameters
integer – the atomic_uint
n – the integer value
- Returns
sum of the 2 values
Bitwise XOR and fetch atomically
- Parameters
integer – the atomic_uint
n – data to XOR
- Returns
the result value
On Microsoft Windows
Increment and fetch atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – bytes will be added to the array.
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the contents of resulted bytearray
bittest_and_reset the original contents in the bytearray
- Parameters
array – target array to change.
reference – reference got by the subprocess.
offset – offset from counted by bits from the left.
- Returns
original value(True or False) at the offset
bittest_and_set the original contents in the bytearray
- Parameters
array – target array to change.
reference – reference got by the subprocess.
offset – offset from counted by bits from the left.
- Returns
original value(True or False) at the offset
Compare and set atomically,This compares the contents of self with the contents of i. 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 itself are written into i.
- Parameters
array – target array to change.
reference – reference got by the subprocess.
i – The exchange value
n – The value to compare to
trim – whether the returned bytes should be trimmed of tailing b’
fetch and increment atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – the bytes will be added to the array
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise AND atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – the other operands of AND operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise OR atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – the other operands of OR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
fetch and decrement atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – the bytes will be substracted from the array
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Fetch then bitwise XOR atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – the other operands of XOR operation
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the original contents of the bytearray
Get and set atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
data – new data
trim – if True, the leading b’\0’ would be trimmed, by default: True
- Returns
the original bytes
Get all the bytes from the bytearray atomically
- Parameters
array – target array.
reference – reference got by the subprocess .
trim – if True, the leading b’\0’ would be trimmed, by default: True
- Returns
all the bytes in the bytearray
Get the integer representation from the bytearray, the whole array would be treated as a large integer
- Parameters
array – target array.
reference – reference got by the subprocess .
- Returns
the integer representation
Set the bytes for the bytearray,
- Parameters
array – target array.
reference – reference got by the subprocess.
data – bytes to set the data.
- Returns
None
Decrement and fetch atomically
- Parameters
array – target array to change.
reference – reference got by the subprocess.
n – bytes will be subtracted from the array.
trim – whether of not to trim the returning b’\0’ when fetch, default True
- Returns
the contents of resulted bytearray
Compare and swap atomically, This compares the contents of subprocess reference 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 is performed.
- Parameters
reference – the reference used in subprocess
e – The exchange value
n – the value to be compared with
- Returns
the initial value
get the contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
- Returns
the boolean value
get and set contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
n – the boolean value to set from
- Returns
the original boolean value
set the contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
n – the boolean value to set from
- Returns
None
get reference from the shared atomic_object in multiprocessing imcompatible mode.
- Parameters
a – the atomic_object to get the reference from
- Returns
subprocess_reference can be used in subprocesses
increment and fetch atomically
- Parameters
reference – the reference used in subprocess
n – the integer value
- Returns
sum of the 2 values
Tests the specified bit and set it to 0 atomically
- Parameters
reference – the reference used in subprocess
offset – offset in the binary presenation of the 64bit integer
- Returns
the initial value(True or False) of specified bit
fetch then bitwise NAND atomically
- Parameters
reference – the reference used in subprocess
offset – offset in the binary presenation of the 64bit integer
- Returns
the initial value(True or False) of specified bit
Compare and swap atomically, This compares the contents of subprocess reference 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 is performed.
- Parameters
reference – the reference used in subprocess
e – the integer value
n – the integer value
- Returns
the initial value
increment and fetch atomically
- Parameters
reference – the reference used in subprocess
n – data to add
- Returns
the initial value
fetch then bitwise AND atomically
- Parameters
reference – the reference used in subprocess
n – data to AND
- Returns
the initial value
fetch then bitwise OR atomically
- Parameters
reference – the reference used in subprocess
n – data to OR
- Returns
the initial value
subtract and fetch atomically
- Parameters
reference – the reference used in subprocess
n – data to subtract
- Returns
the initial value
fetch then bitwise XOR atomically
- Parameters
reference – the reference used in subprocess
n – data to XOR
- Returns
the initial value
get the contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
- Returns
the int value
get and set contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
n – the integer value to set from
- Returns
the original int value
set the contents of subprocess reference atomically.
- Parameters
reference – the reference used in subprocess
n – the integer value to set from
- Returns
None
sub and fetch atomically
- Parameters
reference – the reference used in subprocess
n – the integer value
- Returns
sum of the 2 values
Compare and set atomically,This compares the contents of input_list with the contents of n. If equal, the operation is a read-modify-write operation that writes i into input_list. If they are not equal, no action will be taken.
- Parameters
input_list – target list.
reference – the reference used in subprocess
i – The exchange value
n – The value to compare to
- Returns
Original value
Get and set atomically
- Parameters
input_list – target list.
reference – the reference used in subprocess
data – new data list
- Returns
the original list
Get the whole integer representation from the list, the whole set would be treated as a large integer
- Parameters
input_list – target list.
reference – the reference used in subprocess
- Returns
the integer representation
Get the list atomically
- Parameters
input_list – target list.
reference – the reference used in subprocess
- Returns
the list
Set the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
input_list – target list.
reference – the reference used in subprocess
- Returns
None
Set the value in the list, if the new data is longer than the original size of the list. it will expand the set accordingly which would lose atomicity. the size of the set can be checked with list.size
- Parameters
input_list – target list.
reference – the reference used in subprocess
data – input list
- Returns
None
release the reference got by get_reference.
- Parameters
a – the subprocess reference to release
- Returns
None
Compare and swap atomically, This compares the contents of self with the contents of n. If equal, the operation is a read-modify-write operation that writes n into self. If they are not equal, No operation is performed.
- Parameters
intput_set – target set to change.
reference – the reference used in subprocess
i – the value to set to
n – The value to be compared with
- Returns
the original set
Get and set atomically
- Parameters
intput_set – target set to change.
reference – the reference used in subprocess
data – new data set
- Returns
the original set
Get the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
intput_set – target set.
reference – the reference used in subprocess
- Returns
the integer representation
Get the set atomically
- Parameters
intput_set – target set.
reference – the reference used in subprocess
- Returns
the set
Set the whole integer representation from the set, the whole set would be treated as a large integer
- Parameters
intput_set – target set.
reference – the reference used in subprocess
integer – integer representation of the new value.
- Returns
None
Set the value in the set, if the new data is longer than the original size of the set. it will expand the set accordingly which would lose atomicity. the size of the set can be checked with set.size
- Parameters
intput_set – target set to change.
reference – the reference used in subprocess
data – input set
- Returns
None
increment and fetch atomically
- Parameters
memory – target shared memory.
reference – the reference used in subprocess
value – data to add
offset – the offset inside the shared memory starting from 0
- Returns
sum of the 2 values
test and reset the bit at offset atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
left_offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
test and set the bit at offset atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
left_offset – the offset inside the shared memory starting from 0,
- Returns
the initial value at the offset of memory
Compare and set atomically. This compares the contents of pointer with the contents of self at offset. If equal, the operation is a read-modify-write operation that writes bytes parameter value into self. If they are not equal, the operation is a read and the current contents of self are written into pointer.
- Parameters
memory – target shared memory.
reference – the reference used in subprocess
i – the value to set
n – the value to be compared with
offset – the offset inside the shared memory starting from 0 you need to compare and set,
- Returns
the initial value at the offset of memory
fetch and increment atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
value – data to add
offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
fetch and and atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
value – data to and
offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
fetch and or atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
value – data to or
offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
fetch and substract atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
value – data to substract
offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
fetch and xor atomically
- Parameters
memory – target shared memory to change.
reference – the reference used in subprocess
value – data to xor
offset – the offset inside the shared memory starting from 0
- Returns
the initial value at the offset of memory
Atomically get the bytes at specific offset given specific length
- Parameters
memory – target shared memory.
reference – the reference used in subprocess
offset – the offset inside the shared memory starting from 0
length – the length of bytes should be retrieved
- Returns
bytes at specific offset.
Atomically set the bytes at specific offset an get the original value
- Parameters
memory – target shared memory.
reference – the reference used in subprocess
value – new value in bytes
offset – the offset inside the shared memory starting from 0
- Returns
bytes at specific offset previously.
substract and fetch atomically
- Parameters
memory – target shared memory.
reference – the reference used in subprocess
value – data to substract
offset – the offset inside the shared memory starting from 0
- Returns
difference of the 2 values
Compare and swap atomically, This compares the contents in subprocess_reference reference with the contents of n. If equal, the operation is a read-modify-write operation that writes i into self. If they are not equal, No operation is performed.
- Parameters
string – target string.
reference – the reference used in subprocess.
i – The exchange value
n – the value to be compared with
- Returns
the original string
Get and set atomically
- Parameters
string – target string.
reference – the reference used in subprocess.
data – new data
- Returns
the original string
Get all the bytes from the string atomically
- Parameters
string – target string.
reference – the reference used in subprocess
- Returns
the full string
Set the bytes value in the string, if the new data is longer than the original size of the string. it will expand the string accordingly which would lose atomicity. the size of the string can be check with self.size
- Parameters
string – target string.
reference – the reference used in subprocess.
data – value to set to
- Returns
None
class of subprocess references generated for multiprocessing mode
initialize the class.
- Parameters
file_mapping – the file mapping handle
reference – the pointer used
- Returns
subprocess_reference