FThreadSafeCounter

Thread safe counter

Windows
MacOS
Linux

Inheritance Hierarchy

FThreadSafeCounter

FThreadSafeBool

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/HAL/ThreadSafeCounter.h

Include

#include "HAL/ThreadSafeCounter.h"

Syntax

class FThreadSafeCounter

Remarks

Thread safe counter

Constructors

Name Description

Public function

FThreadSafeCounter()

Default constructor.

Initializes the counter to 0.

Public function

FThreadSafeCounter

(
    const FThreadSafeCounter& Other
)

Copy Constructor.

Public function

FThreadSafeCounter

(
    int32 Value
)

Constructor, initializing counter to passed in value.

Functions

Name Description

Public function

int32

 

Add

(
    int32 Amount
)

Adds an amount and returns the old value.

Public function

int32

 

Decrement()

Decrement and return new value.

Public function Const

int32

 

GetValue()

Gets the current value.

Public function

int32

 

Increment()

Increment and return new value.

Public function

int32

 

Reset()

Resets the counter's value to zero.

Public function

int32

 

Set

(
    int32 Value
)

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

Public function

int32

 

Subtract

(
    int32 Amount
)

Subtracts an amount and returns the old value.

Typedefs

Name

Description

IntegerType

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback