Navigation
API > API/Runtime > API/Runtime/Core
A chain of tasks that are executed one after another. Can be used to synchronise access to a shared resource as FPipe guarantees non-concurrent tasks execution. FPipe is a replacement for named threads because it's lightweight and flexible - there can be a large dynamic number of pipes each controlling its own shared resource. Can be used as a replacement for dedicated threads. Execution order is FIFO for tasks that don't have prerequisites, i.e. it's the same as launching order. Adding prerequisites to a pipe task can alter when the task is queued to the pipe, hence can change the execution order. A pipe must be alive until its last task is completed. See `FTasksPipeTest_ for tests and examples.
| Name | FPipe |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Tasks/Pipe.h |
| Include Path | #include "Tasks/Pipe.h" |
Syntax
class FPipe
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Tasks/Pipe.h | |||
| Tasks/Pipe.h | |||
FPipe
(
const TCHAR* InDebugName |
Tasks/Pipe.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FPipe() |
Tasks/Pipe.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| DebugName | const TCHAR *const | Tasks/Pipe.h | ||
| EmptyEventRef | TSharedRef< UE::FEventCount > | Tasks/Pipe.h | ||
| LastTask | std::atomic< Private::FTaskBase * > | Pipe builds a chain (a linked list) of tasks and so needs to store only the last one. the last task is null if the pipe is not blocked | Tasks/Pipe.h | |
| TaskCount | std::atomic< uint64 > | Tasks/Pipe.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const TCHAR * GetDebugName() |
Tasks/Pipe.h | ||
bool HasWork() |
Returns `true_ if the pipe has any not completed tasks | Tasks/Pipe.h | |
bool IsInContext () |
Checks if pipe's task is being executed by the current thread. | Tasks/Pipe.h | |
TTask< TInvokeResult_T< TaskBodyType > > Launch
(
const TCHAR* InDebugName, |
Launches a task in the pipe | Tasks/Pipe.h | |
TTask< TInvokeResult_T< TaskBodyType > > Launch
(
const TCHAR* InDebugName, |
Launches a task in the pipe, with multiple prerequisites that must be completed before the task is scheduled | Tasks/Pipe.h | |
bool WaitUntilEmpty
(
FTimespan Timeout |
Waits until the pipe is empty (its last task is executed) should be used only after no more tasks are launched in the pipe, e.g. preparing for the pipe destruction | Tasks/Pipe.h |