# atomicFetchAdd

`import { atomicFetchAdd } from "destack:sync";`

Atomic fetch-and-add.

Atomically adds `value` to the value at `ptr`.
Returns the previous value before the addition.

```ds title="atomicFetchAdd"
export declare function atomicFetchAdd<T: Integer>(ptr: *T, value: T, order: MemoryOrdering, scope: AtomicScope, memoryScope: MemoryScope, regions: MemoryRegionSet, isVolatile: boolean, isMakeAvailable: boolean, isMakeVisible: boolean): T
```

[language/library/src/sync/atomic.ds:288:298](https://github.com/destack-sh/destack/blob/main/language/library/src/sync/atomic.ds#L288-L298)
