Limen Framework 0.1 Help

ULimenThreadPoolSubsystem

Overview

ULimenThreadPoolSubsystem is a subsystem that manages a pool of worker threads. It provides methods to add various types of jobs (synchronous, slice-based) and ensures they are executed on separate threads. The subsystem initializes the thread pool based on developer settings and handles job distribution among available threads.

Properties

Type

Name

Access

Description

TMap<TSharedRef<FPoolWorker, ESPMode::NotThreadSafe>, TSharedRef<FRunnableThread, ESPMode::NotThreadSafe>>

ThreadPool

Private

A map of worker threads to their corresponding runnable thread objects.

int32

ThreadCount

Private

The number of worker threads in the pool.

Functions

Return Type

Signature

Description

bool

ShouldCreateSubsystem(UObject* Outer) const

Determines if the subsystem should be created based on system capabilities and developer settings.

void

Initialize(FSubsystemCollectionBase& Collection)

Initializes the thread pool with a number of threads specified in developer settings.

void

Deinitialize()

Destroys all worker threads and cleans up resources.

void

AddJob(const TFunction<void()>& Job)

Adds a synchronous job to the thread pool.

void

AddJob(const TFunction<bool(double)>& Job)

Adds a slice-based job to the thread pool.

void

AddJob(const TSharedRef

& Job)

Adds an ISliceJob to the thread pool.

void

CreateThreads()

Creates worker threads based on developer settings.

void

DestroyThreads()

Destroys all worker threads and waits for their completion.

TSharedRef<FPoolWorker, ESPMode::NotThreadSafe>

GetAvailableThread() const

Retrieves the worker thread with the least number of queued jobs.

Usage & Implementation Notes

  • Threading Constraints: The subsystem operates on a separate thread pool, ensuring that job execution does not block the game thread.

  • Replication Requirements: None.

  • Memory Lifetime Management: Worker threads and their associated resources are managed internally by the subsystem.

  • Initialization Dependencies: Depends on developer settings to determine the number of threads.

22 May 2026