Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » Thing » AtomicInt
next | previous | forward | backward | up | index | toc

# AtomicInt -- the class of atomic integers

## Description

Atomic integers are a special type of integer for which various atomic operations, which cannot be interrupted, are available. This makes them useful for parallel programming.

## Caveat

On most systems, atomic integers use 32 bits, i.e., they must lie between $-2^{31}$ and $2^{31} - 1$.

## See also

- parallel programming with threads and tasks

### Menu

- new AtomicInt from ZZ -- initialize an atomic integer
- new ZZ from AtomicInt -- load an atomic integer
- store -- store the value of an atomic integer
- exchange -- exchange the value of an atomic integer
- compareExchange -- compare and possibly exchange the value of an atomic integer
- AtomicInt += ZZ -- atomic fetch and add
- AtomicInt -= ZZ -- atomic fetch and subtract
- AtomicInt &= ZZ -- atomic fetch and bitwise and
- AtomicInt |= ZZ -- atomic fetch and bitwise or
- AtomicInt ^^= ZZ -- atomic fetch and bitwise xor

## Methods that use an atomic integer:

- AtomicInt &= ZZ -- atomic fetch and bitwise and
- AtomicInt += ZZ -- atomic fetch and add
- AtomicInt -= ZZ -- atomic fetch and subtract
- AtomicInt ^^= ZZ -- atomic fetch and bitwise xor
- AtomicInt |= ZZ -- atomic fetch and bitwise or
- `compareExchange(AtomicInt,ZZ,ZZ)` -- see compareExchange -- compare and possibly exchange the value of an atomic integer
- `exchange(AtomicInt,ZZ)` -- see exchange -- exchange the value of an atomic integer
- `new AtomicInt` -- see new AtomicInt from ZZ -- initialize an atomic integer
- new AtomicInt from ZZ -- initialize an atomic integer
- new ZZ from AtomicInt -- load an atomic integer
- `store(AtomicInt,ZZ)` -- see store -- store the value of an atomic integer

## For the programmer

The object AtomicInt is a type, with ancestor class Thing.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/doc_atomic.m2:28:0.