Macaulay2 » Documentation
Packages » Macaulay2Doc :: exchange
next | previous | forward | backward | up | index | toc

exchange -- exchange the value of an atomic integer

Synopsis

Description

The value of y is stored in x and the original value of x is returned. This operation occurs atomically and is thread safe.

i1 : x = new AtomicInt

o1 = 0

o1 : AtomicInt
i2 : exchange(x, 5)

o2 = 0
i3 : x

o3 = 5

o3 : AtomicInt

Ways to use exchange :

For the programmer

The object exchange is a method function.