UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FThreadSafeCounter64 Class Reference

#include <ThreadSafeCounter64.h>

Public Types

typedef int64 IntegerType
 

Public Member Functions

 FThreadSafeCounter64 ()
 
 FThreadSafeCounter64 (const FThreadSafeCounter64 &Other)
 
FThreadSafeCounter64operator= (const FThreadSafeCounter64 &Other)
 
 FThreadSafeCounter64 (int64 Value)
 
int64 Increment ()
 
int64 Add (int64 Amount)
 
int64 Decrement ()
 
int64 Subtract (int64 Amount)
 
int64 Set (int64 Value)
 
int64 Reset ()
 
int64 GetValue () const
 

Detailed Description

Thread safe counter for 64bit ints

Member Typedef Documentation

◆ IntegerType

Constructor & Destructor Documentation

◆ FThreadSafeCounter64() [1/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( )
inline

Default constructor.

Initializes the counter to 0.

◆ FThreadSafeCounter64() [2/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( const FThreadSafeCounter64 Other)
inline

Copy Constructor.

If the counter in the Other parameter is changing from other threads, there are no guarantees as to which values you will get up to the caller to not care, synchronize or other way to make those guarantees.

Parameters
OtherThe other thread safe counter to copy

◆ FThreadSafeCounter64() [3/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( int64  Value)
inline

Constructor, initializing counter to passed in value.

Parameters
ValueValue to initialize counter to

Member Function Documentation

◆ Add()

int64 FThreadSafeCounter64::Add ( int64  Amount)
inline

Adds an amount and returns the old value.

Parameters
AmountAmount to increase the counter by
Returns
the old value
See also
Decrement, Increment, Reset, Set, Subtract

◆ Decrement()

int64 FThreadSafeCounter64::Decrement ( )
inline

Decrement and return new value.

Returns
the new, decremented value
See also
Add, Increment, Reset, Set, Subtract

◆ GetValue()

int64 FThreadSafeCounter64::GetValue ( ) const
inline

Gets the current value.

Returns
the current value

◆ Increment()

int64 FThreadSafeCounter64::Increment ( )
inline

Increment and return new value.

Returns
the new, incremented value
See also
Add, Decrement, Reset, Set, Subtract

◆ operator=()

FThreadSafeCounter64 & FThreadSafeCounter64::operator= ( const FThreadSafeCounter64 Other)
inline

Assignment has the same caveats as the copy ctor.

◆ Reset()

int64 FThreadSafeCounter64::Reset ( )
inline

Resets the counter's value to zero.

Returns
the old value.
See also
Add, Decrement, Increment, Set, Subtract

◆ Set()

int64 FThreadSafeCounter64::Set ( int64  Value)
inline

Sets the counter to a specific value and returns the old value.

Parameters
ValueValue to set the counter to
Returns
The old value
See also
Add, Decrement, Increment, Reset, Subtract

◆ Subtract()

int64 FThreadSafeCounter64::Subtract ( int64  Amount)
inline

Subtracts an amount and returns the old value.

Parameters
AmountAmount to decrease the counter by
Returns
the old value
See also
Add, Decrement, Increment, Reset, Set

The documentation for this class was generated from the following file: