Navigation
API > API/Runtime > API/Runtime/Core
Thread safe counter
| Name | FThreadSafeCounter |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/HAL/ThreadSafeCounter.h |
| Include Path | #include "HAL/ThreadSafeCounter.h" |
Syntax
class FThreadSafeCounter
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FThreadSafeCounter
(
int32 Value |
Constructor, initializing counter to passed in value. | HAL/ThreadSafeCounter.h | |
FThreadSafeCounter
(
const FThreadSafeCounter& Other |
Copy Constructor. | HAL/ThreadSafeCounter.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| IntegerType | int32 | HAL/ThreadSafeCounter.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Counter | volatile int32 | Thread-safe counter | HAL/ThreadSafeCounter.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
int32 Add
(
int32 Amount |
Adds an amount and returns the old value. | HAL/ThreadSafeCounter.h | |
int32 Decrement () |
Decrement and return new value. | HAL/ThreadSafeCounter.h | |
int32 GetValue() |
Gets the current value. | HAL/ThreadSafeCounter.h | |
int32 Increment () |
Increment and return new value. | HAL/ThreadSafeCounter.h | |
int32 Reset () |
Resets the counter's value to zero. | HAL/ThreadSafeCounter.h | |
int32 Set
(
int32 Value |
Sets the counter to a specific value and returns the old value. | HAL/ThreadSafeCounter.h | |
int32 Subtract
(
int32 Amount |
Subtracts an amount and returns the old value. | HAL/ThreadSafeCounter.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void operator=
(
const FThreadSafeCounter& Other |
Assignment is intentionally disallowed, as usage wouldn't be thread safe. | HAL/ThreadSafeCounter.h |