From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function AtomicDecrement(var Target; [Decrement]): Integer; overload;
function AtomicDecrement(var Target; [Decrement]): Int64; overload;


Type Visibility Source Unit Parent
function public System.pas System System


Atomic intrinsic Decrement function for use with Object Pascal mobile compilers. Decrements the specified number (<Target>) by the specified number (<Decrement>) or 1 if the <Decrement> parameter is not specified. Returns the new value of <Target>.

Because the Object Pascal mobile compilers do not support a built-in assembler, the System unit provides four atomic intrinsic functions that provide a way to atomically exchange, compare and exchange, increment, and decrement memory values.

AtomicDecrement is used for decrementing memory values.

Atomic operations are used to:

  • Implement multi-threaded locking primitives
  • Provide the primitives necessary for implementing so-called "lock-free" structures

See Also