System.AtomicIncrement

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function AtomicIncrement(var Target: Integer; Increment: Integer): Integer; overload;
function AtomicIncrement(var Target: Int64; Increment: Int64): Int64; overload;

Properties

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

Description

Atomic intrinsic Increment function for use with Delphi mobile compilers. Increments the specified number (Target) by the specified number (Increment) or 1 if the Increment parameter is not specified. Returns the new value of Target.

Because the Delphi 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.

AtomicIncrement is used for incrementing 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