# UnsafeAtomicCounter64

> A 64-bit atomic counter.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public struct UnsafeAtomicCounter64
```

## Remarks

Rather than have its own long, a counter "points" to a long. This arrangement lets counters in different jobs share reference to the same underlying long.

## Fields

| Value                                                                                                         | Description                                |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| [Counter](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/counter.md) | The long that is modified by this counter. |

## Constructors

| Constructor                                                                                                                             | Description                                                   |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [UnsafeAtomicCounter64(System.Void\*)](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/ctor.md) | Initializes and returns an instance of UnsafeAtomicCounter64. |

## Methods

| Method                                                                                                      | Description                                                                                       |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [Add](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/add.md)       | Atomically adds a value to this counter.                                                          |
| [AddSat](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/addsat.md) | Atomically adds a value to this counter. The result will not be greater than a maximum value.     |
| [Reset](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/reset.md)   | Non-atomically sets this counter to a value.                                                      |
| [Sub](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/sub.md)       | Atomically subtracts a value from this counter.                                                   |
| [SubSat](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeatomiccounter64/subsat.md) | Atomically subtracts a value from this counter. The result will not be less than a minimum value. |
