Shared Memory API:

Module shared_atomic.atomic_shared_memory

class shared_atomic.atomic_shared_memory.atomic_shared_memory

Shared memory provide atomic operations

:attributes

standalone: readonly pointer to the start of the shared memory

dealloc_async: public whether the deallocation run in asynchronized fashion, useless on Microsoft Windows platform.

f: readonly file property to access the standalone file if standalone shared memory is specified

buf: memoryview interface

__init__(self, initial: bytes = b'\x00', length: int = None, paddingdirection: unicode = None, paddingbytes: bytes = b'\x00', trimming_direction: unicode = 'right', source: unicode = 'p', previous_shared_memory_path: unicode = None, remove_previous_file: bool = False, dealloc_async: bool = False)

constructor to initialize the shared memory

param initial:

initial value in the shared memory.

param length:

the expected length after padding/trimming for the input value, if not specified, no padding or trimming performed, use original value.

param paddingdirection:

if not specified, no padding is performed, if specified, right, or left side the padding bytes would be added, use ‘right’ or ‘r’ to specify right side, use ‘left’ or ‘l’ to specify the left side.

param paddingbytes:

bytes to pad to the original bytes, by default b’0’ can be multiple bytes like b’ab’, will be padded to the original bytes in circulation until the expected length is reached.

param trimming_direction:

if initial bytes are longer, on which side the bytes will be trimmed. By default, on the right side, use ‘right’ or ‘r’ to specify right side, use ‘left’ or ‘l’ to specify the left side.

param source:

if the data source is file, use ‘f’, if the data source is the initial parameter, let it remain default ‘p’.

param previous_shared_memory_path:

if the data source is file, set the path of the file

param remove_previous_file:

if the data source is file, whether the data file should be deleted after initialization

param dealloc_async:

whether the deallocation run in asynchronized fashion, useless on Microsoft Windows platform.

dealloc_async

dealloc_async: bool

file_sync(self, async: bool = False, start: int = 0, length: int = 0) int

sync to the file system for standalone shared memory

param async:

whether the file writes are synchronized on unix platform, True for asynchronize, False for synchronize. Useless on windows platform, which is always synchronized

param start:

starting offset of the shared memory to sync.

param length:

length of bytes in the shared memory to sync.

return:

0 if sucessful, raises exception otherwise.

memdump(self, file_path: unicode, start: int = 0, length: int = 0) int
Dump the data at specific offset given specific length using memcpy, it’s NOT atomic method

the data can be any length.

param file_path:

file path the dump of the shared memory is written to

param start:

offset in the shared memory from which the data is dumped

param length:

the length of data in bytes to dump

return:

number of bytes written to disk

offset_add_and_fetch(self, value: bytes, offset: int = 0) bytes

increment and fetch atomically

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to add,

return:

sum of the 2 values

offset_add_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

increment and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to add to, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of sum of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_and_and_fetch(self, value: bytes, offset: int = 0) bytes

bitwise AND and fetch the result atomically

param value:

data to AND

param offset:

the offset inside the shared memory starting from 0 you need to AND with,

return:

the result value

offset_and_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Bitwise AND and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to AND, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of differences of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_compare_and_set(self, shared_memory2: atomic_shared_memory, value: bytes, offset: int = 0, offset2: int = 0) bool

Compare and set atomically. This compares the contents of shared_memory2 at offset2 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 shared_memory2.

param shared_memory2:

the other shared memory from which the data is from

param value:

the value to write to the shared memory,

param offset:

the offset inside the shared memory starting from 0 you need to set,

param offset2:

the offset2 inside the shared memory 2 starting from 0 you need to get,

return:

whether the contents of self and contents of shared_memory2 is the same

offset_compare_and_set_value(self, i: bytes, n: bytes, offset: int = 0) bytes

Compare and set atomically. This compares the contents of n 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, no operation will be taken.

param i:

exchange value

param n:

The value to be compared with

param offset:

the offset inside the shared memory starting from 0 you need to set,

return:

the original value at offset

offset_compare_and_set_values(self, ies: const_char[:, _:], ns: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Atomically get and set the bytes at specific offsets given specific lengths

param ies:

rows of bytes to set from, each row will be right trimmed according to the lengths array

param ns:

rows of bytes to be compared with, each row will be right trimmed according to the lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes at specific offsets, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_compare_and_sets(self, other_memories: list, values: const_char[:, _:], offsets: const_size_t[:], offsets2: const_size_t[:], lengths: const_char[:], parallelism: int = 0) list

Compare and set atomically. This compares the contents of shared_memory2 at offset2 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 shared_memory2.

param other_memories:

the other shared memorys from which the data is from

param values:

the value to write to the shared memory,

param offsets:

the offset inside the shared memory starting from 0 you need to set,

param offsets2:

the offset2 inside the shared memory 2 starting from 0 you need to get,

param lengths:

the length to compare and set,

return:

whether the contents of self and contents of shared_memory2 is the same

offset_compare_with_other_type_and_set(self, object2: atomic_object, value: bytes, offset: int = 0) bool
Compare and set atomically. This compares the contents of another atomic_object 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 object2.

param object2:

the other atomic object from which the data is compared with

param offset:

the offset inside the shared memory starting from 0 you need to compare and set,

param value:

value to be set

return:

whether the contents of self and contents of object2 is the same

offset_fetch_and_add(self, value: bytes, offset: int = 0) bytes

fetch and increment atomically

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to add to,

return:

original value

offset_fetch_and_adds(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and increment atomically at specific offsets given specific lengths

param values:

rows of bytes to add to, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_fetch_and_and(self, value: bytes, offset: int = 0) bytes

fetch then bitwise AND atomically

param value:

value to AND to

param offset:

the offset inside the shared memory starting from 0 you need to AND to,

return:

original value

offset_fetch_and_ands(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and AND atomically at specific offsets given specific lengths

param values:

rows of bytes to and, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_fetch_and_nand(self, value: bytes, offset: int = 0) bytes

fetch then bitwise NAND atomically

param value:

value to NAND with

param offset:

the offset inside the shared memory starting from 0 you need to NAND with,

return:

original value

offset_fetch_and_nands(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and NAND atomically at specific offsets given specific lengths

param values:

rows of bytes to xor, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_fetch_and_or(self, value: bytes, offset: int = 0) bytes

fetch then bitwise OR atomically

param value:

value to OR with

param offset:

the offset inside the shared memory starting from 0 you need to OR with,

return:

original value

offset_fetch_and_ors(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and OR atomically at specific offsets given specific lengths

param values:

rows of bytes to or, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_fetch_and_sub(self, value: bytes, offset: int = 0) bytes

fetch and substract atomically

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to substract from,

return:

original value

offset_fetch_and_subs(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and substract atomically at specific offsets given specific lengths

param values:

rows of bytes to substract, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_fetch_and_xor(self, value: bytes, offset: int = 0) bytes

fetch then bitwise XOR atomically

param value:

value to XOR with

param offset:

the offset inside the shared memory starting from 0 you need to XOR with,

return:

original value

offset_fetch_and_xors(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

fetch and XOR atomically at specific offsets given specific lengths

param values:

rows of bytes to xor, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of original bytes representation of shared memory, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_get(self, offset: int = 0, length: int = 1) bytes

Atomically get the bytes at specific offset given specific length

param offset:

the offset inside the shared memory starting from 0, including the operation length

param length:

the length of bytes should be retrieved

return:

bytes at specific offset.

offset_get_and_set(self, value: bytes, offset: int = 0) bytes

Atomically set the bytes at specific offset given specific length

param value:

new value in bytes

param offset:

the offset inside the shared memory starting from 0, including the operation length

return:

bytes at specific offset previously.

offset_get_and_sets(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Atomically get the bytes at specific offsets given specific lengths

param values:

rows of bytes at specific offsets, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of bytes at specific offsets, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_gets(self, offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Atomically get the bytes at specific offsets given specific lengths

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of bytes at specific offsets, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_memmove(self, mv: object, offset: int = 0, io_flags: unicode = 'i') void
Set or read the data at specific offset given specific length using memcpy, it’s NOT atomic method

the data can be any length incase you don’t need atomicity or should use other lengths

param mv:

the data source as memoryview to read from or write to

param offset:

offset in the shared memory to read from or write to

param io_flags:

‘i’ to write from the mv to the shared memory, ‘o’ to read from the shared memory to the mv

return:

None

offset_nand_and_fetch(self, value: bytes, offset: int = 0) bytes

bitwise NAND and fetch the result atomically

param value:

data to NAND

param offset:

the offset inside the shared memory starting from 0 you need to NAND with,

return:

the result value

offset_nand_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Bitwise NAND and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to NAND, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of differences of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_or_and_fetch(self, value: bytes, offset: int = 0) bytes

bitwise OR and fetch the result atomically

param value:

data to OR

param offset:

the offset inside the shared memory starting from 0 you need to OR with,

return:

the result value

offset_or_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Bitwise OR and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to OR, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of differences of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_store(self, shared_memory2: atomic_shared_memory, offset: int = 0, offset2: int = 0, length: int = 1) void

Atomically set the data at specific offset given specific length

param shared_memory2:

the other shared memory from which the data is from

param offset:

the offset inside the shared memory starting from 0 you need to set,

param offset2:

the offset inside the shared memory from the data you want,

param 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

return:

None

offset_store_from_other_types(self, object2: atomic_object, offset: int = 0) void
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.

param object2:

the other atomic object from which the data is from

param offset:

the offset inside the shared memory starting from 0 you need to set

return:

None

offset_stores(self, other_memories: list, offsets: size_t[:], offsets2: const_size_t[:], lengths: const_char[:], parallelism: int = 0) void
offset_stores_from_other_types(self, other_objects: list, offsets: const_size_t[:], parallelism: int = 0) void
offset_sub_and_fetch(self, value: bytes, offset: int = 0) bytes

increment and fetch atomically

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to add,

return:

sum of the 2 values

offset_sub_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

substract and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to substract, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of differences of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

offset_xor_and_fetch(self, value: bytes, offset: int = 0) bytes

bitwise XOR and fetch the result atomically

param value:

data to XOR

param offset:

the offset inside the shared memory starting from 0 you need to XOR with,

return:

the result value

offset_xor_and_fetches(self, values: const_char[:, _:], offsets: const_size_t[:], lengths: const_char[:], parallelism: int = 0) char[:,_::1]

Bitwise XOR and fetch atomically at specific offsets given specific lengths

param values:

rows of bytes to XOR, rows will be right trimmed according to lengths array

param offsets:

the array of offsets inside the shared memory starting from 0

param lengths:

the array of lengths of bytes should be retrieved

param parallelism:

the wanted degree of parallelism

return:

rows of differences of the two bytes representation of values and shared memory bytes, the width is the max given length, rows of other lengths are padded by ‘0’.

shared_atomic.atomic_shared_memory.shared_memory_offset_add_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

increment and fetch atomically

param memory:

target shared memory

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to add,

return:

sum of the 2 values

shared_atomic.atomic_shared_memory.shared_memory_offset_and_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

bitwise AND and fetch the result atomically

param memory:

target shared memory

param value:

data to AND

param offset:

the offset inside the shared memory starting from 0 you need to AND with,

return:

the result value

shared_atomic.atomic_shared_memory.shared_memory_offset_compare_and_set(memory: atomic_shared_memory, shared_memory2: atomic_shared_memory, value: bytes, offset: int = 0, offset2: int = 0) bool

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.

param memory:

target shared memory

param shared_memory2:

the other shared memory from which the data is from

param value:

the value to write to the shared memory,

param offset:

the offset inside the shared memory starting from 0 you need to set,

param offset2:

the offset2 inside the shared memory 2 starting from 0 you need to get,

return:

whether the contents of memory and contents of shared_memory2 is the same

shared_atomic.atomic_shared_memory.shared_memory_offset_compare_and_set_value(memory: atomic_shared_memory, i: bytes, n: bytes, offset: int = 0) bytes

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.

param memory:

target shared memory

param i:

exchange value

param n:

The value to be compared with

param offset:

the offset inside the shared memory starting from 0 you need to set,

return:

the original value at offset

shared_atomic.atomic_shared_memory.shared_memory_offset_compare_with_other_type_and_set(memory: atomic_shared_memory, object2: atomic_object, value: bytes, offset: int = 0) bool

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.

param memory:

target shared memory

param object2:

the other atomic object from which the data is compared with

param offset:

the offset inside the shared memory starting from 0 you need to compare and set,

param value:

value to be set

return:

whether the contents of memory and contents of object2 is the same

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_add(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch and increment atomically

param value:

data to add

param offset:

the offset inside the shared memory starting from 0 you need to add to,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_and(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch then bitwise AND atomically

param value:

value to AND to

param offset:

the offset inside the shared memory starting from 0 you need to AND to,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_nand(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch then bitwise NAND atomically

param value:

value to NAND with

param offset:

the offset inside the shared memory starting from 0 you need to NAND with,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_or(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch then bitwise OR atomically

param value:

value to OR with

param offset:

the offset inside the shared memory starting from 0 you need to OR with,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_sub(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch and substract atomically

param value:

data to sub

param offset:

the offset inside the shared memory starting from 0 you need to substract from,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_fetch_and_xor(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

fetch then bitwise XOR atomically

param value:

value to XOR with

param offset:

the offset inside the shared memory starting from 0 you need to XOR with,

return:

original value

shared_atomic.atomic_shared_memory.shared_memory_offset_get(memory: atomic_shared_memory, offset: int = 0, length: int = 1) bytes

Atomically get the bytes at specific offset given specific length

param memory:

target shared memory

param offset:

the offset inside the shared memory starting from 0

param length:

the length of bytes should be retrieved

return:

bytes at specific offset.

shared_atomic.atomic_shared_memory.shared_memory_offset_get_and_set(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

Atomically set the bytes at specific offset given specific length

param memory:

target shared memory

param value:

new value in bytes

param offset:

the offset inside the shared memory starting from 0, including the operation length

return:

bytes at specific offset previously.

shared_atomic.atomic_shared_memory.shared_memory_offset_nand_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

bitwise NAND and fetch the result atomically

param value:

data to NAND

param offset:

the offset inside the shared memory starting from 0 you need to NAND with,

return:

the result value

shared_atomic.atomic_shared_memory.shared_memory_offset_or_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

bitwise OR and fetch the result atomically

param value:

data to OR

param offset:

the offset inside the shared memory starting from 0 you need to OR with,

return:

the result value

shared_atomic.atomic_shared_memory.shared_memory_offset_store(memory: atomic_shared_memory, shared_memory2: atomic_shared_memory, offset: int = 0, offset2: int = 0, length: int = 1) void

Atomically set the data at specific offset given specific length

param memory:

target shared memory

param shared_memory2:

the other shared memory from which the data is from

param offset:

the offset inside the shared memory starting from 0 you need to set,

param offset2:

the offset inside the shared memory from the data you want,

param 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

return:

None

shared_atomic.atomic_shared_memory.shared_memory_offset_store_from_other_types(memory: atomic_shared_memory, object2: atomic_object, offset: int = 0) void
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.

param memory:

target shared memory

param object2:

the other atomic object from which the data is from

param offset:

the offset inside the shared memory starting from 0 you need to set

return:

None

shared_atomic.atomic_shared_memory.shared_memory_offset_sub_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

increment and fetch atomically

param memory:

target shared memory

param value:

data to sub

param offset:

the offset inside the shared memory starting from 0 you need to add,

return:

sum of the 2 values

shared_atomic.atomic_shared_memory.shared_memory_offset_xor_and_fetch(memory: atomic_shared_memory, value: bytes, offset: int = 0) bytes

bitwise XOR and fetch the result atomically

param value:

data to XOR

param offset:

the offset inside the shared memory starting from 0 you need to XOR with,

return:

the result value