UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FHttpThreadBase Class Referenceabstract

#include <HttpThread.h>

+ Inheritance diagram for FHttpThreadBase:

Public Member Functions

 FHttpThreadBase ()
 
virtual ~FHttpThreadBase ()
 
virtual void StartThread ()
 
virtual void StopThread ()
 
bool IsStopped () const
 
virtual void AddRequest (FHttpRequestCommon *Request)
 
virtual void CancelRequest (FHttpRequestCommon *Request)
 
virtual void GetCompletedRequests (TArray< FHttpRequestCommon * > &OutCompletedRequests)
 
virtual void Tick () override
 
bool NeedsSingleThreadTick () const
 
virtual void UpdateConfigs ()
 
virtual TSharedPtr< IHttpTaskTimerHandleAddHttpThreadTask (TFunction< void()> &&Task, float InDelay)=0
 
virtual void RemoveTimerHandle (FTSTicker::FDelegateHandle DelegateHandle)=0
 
virtual void RemoveTimerHandle (UE::EventLoop::FTimerHandle EventLoopTimerHandle)=0
 

Protected Member Functions

virtual void HttpThreadTick (float DeltaSeconds)
 
virtual bool StartThreadedRequest (FHttpRequestCommon *Request)
 
virtual void CompleteThreadedRequest (FHttpRequestCommon *Request)
 
virtual bool Init () override
 
virtual uint32 Run () override
 
virtual void Stop () override
 
virtual void Exit () override
 
void Process (TArray< FHttpRequestCommon * > &RequestsToCancel, TArray< FHttpRequestCommon * > &RequestsToComplete)
 
virtual class FSingleThreadRunnableGetSingleThreadInterface () override
 

Protected Attributes

FRunnableThreadThread
 
TMpscQueue< FHttpRequestCommon * > NewThreadedRequests
 
TMpscQueue< FHttpRequestCommon * > CancelledThreadedRequests
 
TArray< FHttpRequestCommon * > RateLimitedThreadedRequests
 
TArray< FHttpRequestCommon * > RunningThreadedRequests
 
TSpscQueue< FHttpRequestCommon * > CompletedThreadedRequests
 

Detailed Description

Manages Http thread Assumes any requests entering the system will remain valid (not deleted) until they exit the system

Constructor & Destructor Documentation

◆ FHttpThreadBase()

FHttpThreadBase::FHttpThreadBase ( )

◆ ~FHttpThreadBase()

FHttpThreadBase::~FHttpThreadBase ( )
virtual

Member Function Documentation

◆ AddHttpThreadTask()

virtual TSharedPtr< IHttpTaskTimerHandle > FHttpThreadBase::AddHttpThreadTask ( TFunction< void()> &&  Task,
float  InDelay 
)
pure virtual

Add task to be ran on the http thread next tick

Parameters
TaskThe task to be ran
InDelayThe delay to wait before running the task
Returns
The handle of the timer, which could be used to remove the task before it get triggered

Implemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ AddRequest()

void FHttpThreadBase::AddRequest ( FHttpRequestCommon Request)
virtual

Add a request to begin processing on HTTP thread.

Parameters
Requestthe request to be processed on the HTTP thread

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ CancelRequest()

void FHttpThreadBase::CancelRequest ( FHttpRequestCommon Request)
virtual

Mark a request as cancelled. Called on non-HTTP thread.

Parameters
Requestthe request to be processed on the HTTP thread

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ CompleteThreadedRequest()

void FHttpThreadBase::CompleteThreadedRequest ( FHttpRequestCommon Request)
protectedvirtual

Complete a request on the http thread

Reimplemented in FAppleEventLoopHttpThread.

◆ Exit()

void FHttpThreadBase::Exit ( void  )
overrideprotectedvirtual

Exits the runnable object.

Called in the context of the aggregating thread to perform any cleanup.

See also
Init, Run, Stop

Reimplemented from FRunnable.

◆ GetCompletedRequests()

void FHttpThreadBase::GetCompletedRequests ( TArray< FHttpRequestCommon * > &  OutCompletedRequests)
virtual

Get completed requests. Clears internal arrays. Called on non-HTTP thread.

Parameters
OutCompletedRequestsarray of requests that have been completed

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ GetSingleThreadInterface()

virtual class FSingleThreadRunnable * FHttpThreadBase::GetSingleThreadInterface ( )
inlineoverrideprotectedvirtual

FSingleThreadRunnable accessor for ticking this FRunnable when multi-threading is disabled.

Returns
FSingleThreadRunnable Interface for this FRunnable object.

Reimplemented from FRunnable.

◆ HttpThreadTick()

void FHttpThreadBase::HttpThreadTick ( float  DeltaSeconds)
protectedvirtual

Tick on http thread

Reimplemented in FLegacyHttpThread.

◆ Init()

bool FHttpThreadBase::Init ( void  )
overrideprotectedvirtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ IsStopped()

bool FHttpThreadBase::IsStopped ( ) const
inline

Is the HTTP thread started or stopped.

◆ NeedsSingleThreadTick()

bool FHttpThreadBase::NeedsSingleThreadTick ( ) const

When true the owner of the HTTPThread needs to manually call Tick() since no automomous threads are executing the runnable object

◆ Process()

void FHttpThreadBase::Process ( TArray< FHttpRequestCommon * > &  RequestsToCancel,
TArray< FHttpRequestCommon * > &  RequestsToComplete 
)
protected

◆ RemoveTimerHandle() [1/2]

virtual void FHttpThreadBase::RemoveTimerHandle ( FTSTicker::FDelegateHandle  DelegateHandle)
pure virtual

◆ RemoveTimerHandle() [2/2]

virtual void FHttpThreadBase::RemoveTimerHandle ( UE::EventLoop::FTimerHandle  EventLoopTimerHandle)
pure virtual

◆ Run()

uint32 FHttpThreadBase::Run ( )
overrideprotectedvirtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ StartThread()

void FHttpThreadBase::StartThread ( )
virtual

Start the HTTP thread.

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ StartThreadedRequest()

bool FHttpThreadBase::StartThreadedRequest ( FHttpRequestCommon Request)
protectedvirtual

Start processing a request on the http thread

Reimplemented in FAppleEventLoopHttpThread.

◆ Stop()

void FHttpThreadBase::Stop ( void  )
overrideprotectedvirtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

Reimplemented in FLegacyHttpThread.

◆ StopThread()

void FHttpThreadBase::StopThread ( )
virtual

Stop the HTTP thread. Blocks until thread has stopped.

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ Tick()

void FHttpThreadBase::Tick ( )
overridevirtual

Implements FSingleThreadRunnable.

Reimplemented in FEventLoopHttpThread, and FLegacyHttpThread.

◆ UpdateConfigs()

void FHttpThreadBase::UpdateConfigs ( )
virtual

Update configuration. Called when config has been updated and we need to apply any changes.

Reimplemented in FEventLoopHttpThread.

Member Data Documentation

◆ CancelledThreadedRequests

TMpscQueue<FHttpRequestCommon*> FHttpThreadBase::CancelledThreadedRequests
protected

Threaded requests that are waiting to be cancelled on the http thread. Added to on (any) non-HTTP thread, processed then cleared on HTTP thread.

◆ CompletedThreadedRequests

TSpscQueue<FHttpRequestCommon*> FHttpThreadBase::CompletedThreadedRequests
protected

Threaded requests that have completed and are waiting for the game thread to process. Added to on HTTP thread, processed then cleared on game thread (Single producer, single consumer)

◆ NewThreadedRequests

TMpscQueue<FHttpRequestCommon*> FHttpThreadBase::NewThreadedRequests
protected

Threaded requests that are waiting to be processed on the http thread. Added to on (any) non-HTTP thread, processed then cleared on HTTP thread.

◆ RateLimitedThreadedRequests

TArray<FHttpRequestCommon*> FHttpThreadBase::RateLimitedThreadedRequests
protected

Threaded requests that are ready to run, but waiting due to the running request limit (not in any of the other lists, except potentially CancelledThreadedRequests). Only accessed on the HTTP thread.

◆ RunningThreadedRequests

TArray<FHttpRequestCommon*> FHttpThreadBase::RunningThreadedRequests
protected

Currently running threaded requests (not in any of the other lists, except potentially CancelledThreadedRequests). Only accessed on the HTTP thread.

◆ Thread

FRunnableThread* FHttpThreadBase::Thread
protected

Pointer to Runnable Thread


The documentation for this class was generated from the following files: