FThreadedFunction
Overview
FThreadedFunction is a class derived from FRunnable, designed to simplify multithreading in Unreal Engine. It takes a lambda function as an argument and runs it on a separate thread, providing a straightforward way to perform background tasks without blocking the main game thread.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| Function | Private | The lambda function to be executed on a separate thread. |
| StopCallback | Private | A callback function that is called when the thread stops. |
Functions
Return Type | Signature | Description |
|---|---|---|
|
| Executes the lambda function and returns a success code. |
|
| Calls the stop callback function to clean up resources before stopping the thread. |
Usage & Implementation Notes
The class is designed for use in scenarios where background tasks need to be performed without blocking the main game thread.
The
Runmethod executes the provided lambda function, and theStopmethod ensures that any necessary cleanup is done before the thread stops.This utility can be used in various parts of the application where multithreading is required for performance optimization or responsiveness.