# atomicFetchSub

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

Atomic fetch-and-subtract.

Atomically subtracts `value` from the value at `ptr`.
Returns the previous value before the subtraction.

```ds title="atomicFetchSub"
export declare function atomicFetchSub<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:305:315](https://github.com/destack-sh/destack/blob/main/language/library/src/sync/atomic.ds#L305-L315)
