Navigation
Unreal Engine C++ API Reference > Runtime > Core > Misc
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Misc/Fork.h |
Include | #include "Misc/Fork.h" |
Syntax
class FForkProcessHelper
Remarks
Helper functions for processes that fork in order to share memory pages.
About multithreading: When a process gets forked, any existing threads will not exist on the new forked process. To solve this we use forkable threads that are notified when the fork occurs and will automatically convert themselves into real runnable threads. On the master process, these forkable threads will be fake threads that are executed on the main thread and will block the critical path.
Currently the game code is responsible for calling Fork on itself than calling FForkProcessHelper::OnForkingOccured to transform the forkable threads. Ideally the fork point is done right after the game has loaded all the assets it wants to share so it can maximize the shared memory pool. From the fork point any memory page that gets written into by a forked process will be transferred into a unique page for this process.
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
FRunnableThread * | CreateForkableThread
(
FRunnable* InRunnable, |
Creates a thread according to the environment it's in: In environments with SupportsMultithreading: create a real thread that will tick the runnable object itself In environments without multithreading: create a fake thread that is ticked by the main thread. |
![]() ![]() |
uint16 | Returns the unique index of this forked child process. | |
![]() ![]() |
bool | Is this a process that was forked | |
![]() ![]() |
bool | Are we a forked process that supports multithreading This only becomes true after its safe to be multithread. | |
![]() ![]() |
bool | Returns true if the server process was launched with the intention to fork. | |
![]() ![]() |
void | LowLevelPostForkChild
(
uint16 ChildIndex |
Performs low-level cross-platform actions that should happen immediately AFTER forking in the CHILD process in a well-specified order. |
![]() ![]() |
void | Performs low-level cross-platform actions that should happen immediately AFTER forking in the PARENT process in a well-specified order. | |
![]() ![]() |
void | Performs low-level cross-platform actions that should happen immediately BEFORE forking in a well-specified order. | |
![]() ![]() |
void | Event triggered when a fork occurred on the child process and its safe to create real threads | |
![]() ![]() |
void | SetIsForkedChildProcess
(
uint16 ChildIndex |
Sets the forked child process flag and index given to this child process |
![]() ![]() |
bool | Tells if we allow multithreading on forked processes. |