Procedure Oriented API:

Module shared_atomic.atomic_object

class shared_atomic.atomic_object. atomic_object

parent class of atomic types, other classes inherited this

:attributes

size: readonly size of the object

reference: readonly pointer to the atomic object

current_process_handle: readonly size of the list

windows_unix_compatibility: readonly whether the source code should be compatible with windows x64
mode: readonly ‘s’ for single process, ‘m’ for multiprocessing, on windows platform, only singleprocessing is supported

shared_atomic.atomic_object. bool_compare_and_set ( v : _cffi_backend._CDataBase , e : _cffi_backend._CDataBase , n : bool ) bool

Compare and set atomically. This compares the contents of v 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 v are written into e. :param v: pointer of v :param e: pointer of e :param n: value to be set :return: whether the contents of v and contents of e is the same

shared_atomic.atomic_object. bool_compare_and_set_value ( v : _cffi_backend._CDataBase , e : bool , n : bool ) bool

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

Parameters
  • v – A pointer to the destination value

  • e – The exchange value

  • n – The value to compare to v

Returns

initial value of the v

shared_atomic.atomic_object. bool_get_and_set ( v : _cffi_backend._CDataBase , n : bool ) bool

get and set atomically

Parameters
  • v – pointer of value to get and set

  • n – value to set

Returns

original value

shared_atomic.atomic_object. bool_load ( v : _cffi_backend._CDataBase ) bool

get atomically

Parameters

v – the pointer to the object

Returns

original value

shared_atomic.atomic_object. bool_shift ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase , r : _cffi_backend._CDataBase )

value exchange between 3 pointers in 2 groups atomically, store n in v after store v in r

Parameters
  • v – pointer of v

  • n – pointer of n

  • r – pointer of r

Returns

None

shared_atomic.atomic_object. bool_store ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase )

Store value atomically

Parameters
  • v – the pointer to set

  • n – the pointer from value to set

Returns

None

shared_atomic.atomic_object. float_store ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase )

Store value atomically

Parameters
  • v – the pointer to set

  • n – the pointer from value to set

Returns

None

shared_atomic.atomic_object. int_add_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

increment and fetch atomically

Parameters
  • v – atomic_int to add to and get

  • n – data to add

Returns

sum of the 2 values

shared_atomic.atomic_object. int_and_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

bitwise AND and fetch the result atomically

Parameters
  • v – pointer of value to AND to

  • n – data to AND

Returns

resulted value

shared_atomic.atomic_object. int_compare_and_set ( v: _cffi_backend._CDataBase , e: _cffi_backend._CDataBase , n: long long ) bool

Compare and set atomically. This compares the contents of v 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 v are written into e.

Parameters
  • v – pointer of v

  • e – pointer of e

  • n – value to be set

Returns

whether the contents of v and contents of e is the same

shared_atomic.atomic_object. int_compare_and_set_value ( v: _cffi_backend._CDataBase , e: long long , n: long long ) long long

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

Parameters
  • v – A pointer to the destination value

  • e – The exchange value

  • n – The value to compare to v

Returns

initial value of the v

shared_atomic.atomic_object. int_fetch_and_add ( v: _cffi_backend._CDataBase , n: long long ) long long

increment and fetch atomically

Parameters
  • v – pointer of value to add to

  • n – data to add

Returns

original value in v

shared_atomic.atomic_object. int_fetch_and_and ( v: _cffi_backend._CDataBase , n: long long ) long long

fetch then bitwise AND atomically

Parameters
  • v – pointer of value to AND to

  • n – data to AND

Returns

the result

shared_atomic.atomic_object. int_fetch_and_nand ( v: _cffi_backend._CDataBase , n: long long ) long long

fetch then bitwise NAND atomically

Parameters
  • v – pointer of value to NAND to

  • n – data to NAND

Returns

the result

shared_atomic.atomic_object. int_fetch_and_or ( v: _cffi_backend._CDataBase , n: long long ) long long

fetch then bitwise OR atomically

Parameters
  • v – pointer of value to OR to

  • n – data to OR

Returns

the result

shared_atomic.atomic_object. int_fetch_and_sub ( v: _cffi_backend._CDataBase , n: long long ) long long

subtract and fetch atomically

Parameters
  • v – pointer of value to subtract from

  • n – data to subtract

Returns

original value in v

shared_atomic.atomic_object. int_fetch_and_xor ( v: _cffi_backend._CDataBase , n: long long ) long long

fetch then bitwise XOR atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

the result

shared_atomic.atomic_object. int_get_and_set ( v: _cffi_backend._CDataBase , n: long long ) long long

get and set atomically

Parameters
  • v – pointer of value to get and set

  • n – value to set

Returns

original value

shared_atomic.atomic_object. int_nand_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

bitwise NAND and fetch the result atomically

Parameters
  • v – pointer of value to NAND to

  • n – data to NAND

Returns

resulted value

shared_atomic.atomic_object. int_or_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

bitwise XOR and fetch the result atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

resulted value

shared_atomic.atomic_object. int_shift ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase , r : _cffi_backend._CDataBase )

value exchange between 3 pointers in 2 groups atomically, store n in v after store v in r

Parameters
  • v – pointer of v

  • n – pointer of n

  • r – pointer of r

Returns

None

shared_atomic.atomic_object. int_store ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase )

Store value atomically

Parameters
  • v – the pointer to set

  • n – the pointer from value to set

Returns

None

shared_atomic.atomic_object. int_sub_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

sub and fetch atomically

Parameters
  • v – pointer of value to subtract and get

  • n – data to subtract

Returns

difference of the 2 values

shared_atomic.atomic_object. int_xor_and_fetch ( v: _cffi_backend._CDataBase , n: long long ) long long

bitwise XOR and fetch the result atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

resulted value

class shared_atomic.atomic_object. reference ( file_mapping , reference )

class of reference generated for multiprocessing mode

:attributes file_mapping: internal use

reference: readonly reference used in the subprocesses

shared_atomic.atomic_object. uint_add_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

increment and fetch atomically

Parameters
  • v – pointer of value to add to and get

  • n – data to add

Returns

sum of the 2 values

shared_atomic.atomic_object. uint_and_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

bitwise AND and fetch the result atomically

Parameters
  • v – pointer of value to AND to

  • n – data to AND

Returns

resulted value

shared_atomic.atomic_object. uint_compare_and_set ( v : _cffi_backend._CDataBase , e : _cffi_backend._CDataBase , n : size_t ) bool

Compare and set atomically. This compares the contents of v 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 v are written into e.

Parameters
  • v – pointer of v

  • e – pointer of e

  • n – value to be set

Returns

whether the contents of v and contents of e is the same

shared_atomic.atomic_object. uint_compare_and_set_value ( v : _cffi_backend._CDataBase , e : size_t , n : size_t ) bool

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

Parameters
  • v – A pointer to the destination value

  • e – The exchange value

  • n – The value to compare to v

Returns

initial value of the v

shared_atomic.atomic_object. uint_fetch_and_add ( v : _cffi_backend._CDataBase , n : size_t ) size_t

increment and fetch atomically

Parameters
  • v – pointer of value to add to

  • n – data to add

Returns

original value in v

shared_atomic.atomic_object. uint_fetch_and_and ( v : _cffi_backend._CDataBase , n : size_t ) size_t

fetch then bitwise AND atomically

Parameters
  • v – pointer of value to AND to

  • n – data to AND

Returns

the result

shared_atomic.atomic_object. uint_fetch_and_nand ( v : _cffi_backend._CDataBase , n : size_t ) size_t

fetch then bitwise NAND atomically

Parameters
  • v – pointer of value to NAND to

  • n – data to NAND

Returns

the result

shared_atomic.atomic_object. uint_fetch_and_or ( v : _cffi_backend._CDataBase , n : size_t ) size_t

fetch then bitwise OR atomically

Parameters
  • v – pointer of value to OR to

  • n – data to OR

Returns

the result

shared_atomic.atomic_object. uint_fetch_and_sub ( v : _cffi_backend._CDataBase , n : size_t ) size_t

subtract and fetch atomically

Parameters
  • v – pointer of value to subtract from

  • n – data to subtract

Returns

original value in v

shared_atomic.atomic_object. uint_fetch_and_xor ( v : _cffi_backend._CDataBase , n : size_t ) size_t

fetch then bitwise XOR atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

the result

shared_atomic.atomic_object. uint_get_and_set ( v : _cffi_backend._CDataBase , n : size_t ) size_t

get and set atomically

Parameters
  • v – pointer of value to get and set

  • n – value to set

Returns

original value

shared_atomic.atomic_object. uint_nand_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

bitwise NAND and fetch the result atomically

Parameters
  • v – pointer of value to NAND to

  • n – data to NAND

Returns

resulted value

shared_atomic.atomic_object. uint_or_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

bitwise XOR and fetch the result atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

resulted value

shared_atomic.atomic_object. uint_shift ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase , r : _cffi_backend._CDataBase )

value exchange between 3 pointers in 2 groups atomically, store n in v after store v in r

Parameters
  • v – pointer of v

  • n – pointer of n

  • r – pointer of r

Returns

None

shared_atomic.atomic_object. uint_store ( v : _cffi_backend._CDataBase , n : _cffi_backend._CDataBase )

Store value atomically

Parameters
  • v – the pointer to set

  • n – the pointer from value to set

Returns

None

shared_atomic.atomic_object. uint_sub_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

sub and fetch atomically

Parameters
  • v – pointer of value to subtract and get

  • n – data to subtract

Returns

difference of the 2 values

shared_atomic.atomic_object. uint_xor_and_fetch ( v : _cffi_backend._CDataBase , n : size_t ) size_t

bitwise XOR and fetch the result atomically

Parameters
  • v – pointer of value to XOR to

  • n – data to XOR

Returns

resulted value