UnsafeAtomicCounter32
A 32-bit atomic counter.
Read time 1 minuteLast updated 20 days ago
Definition
- Type: Struct
- Namespace: Unity.Collections.LowLevel.Unsafe
- Assembly: UnityEngine.ManagedKernelModule
public struct UnsafeAtomicCounter32
Remarks
Rather than have its own int, a counter "points" to an int. This arrangement lets counters in different jobs share reference to the same underlying int.
Fields
Value | Description |
|---|---|
| Counter | The int that is modified by this counter. |
Constructors
Constructor | Description |
|---|---|
| UnsafeAtomicCounter32(System.Void*) | Initializes and returns an instance of UnsafeAtomicCounter32. |
Methods
Method | Description |
|---|---|
| Add | Atomically adds a value to this counter. |
| AddSat | Atomically adds a value to this counter. The result will not be greater than a maximum value. |
| Reset | Non-atomically sets this counter to a value. |
| Sub | Atomically subtracts a value from this counter. |
| SubSat | Atomically subtracts a value from this counter. The result will not be less than a minimum value. |