Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FRunnable Class Referenceabstract

#include <Runnable.h>

+ Inheritance diagram for FRunnable:

Public Member Functions

virtual bool Init ()
 
virtual uint32 Run ()=0
 
virtual void Stop ()
 
virtual void Exit ()
 
virtual class FSingleThreadRunnableGetSingleThreadInterface ()
 
virtual ~FRunnable ()
 

Detailed Description

Interface for "runnable" objects.

A runnable object is an object that is "run" on an arbitrary thread. The call usage pattern is Init(), Run(), Exit(). The thread that is going to "run" this object always uses those calling semantics. It does this on the thread that is created so that any thread specific uses (TLS, etc.) are available in the contexts of those calls. A "runnable" does all initialization in Init().

If initialization fails, the thread stops execution and returns an error code. If it succeeds, Run() is called where the real threaded work is done. Upon completion, Exit() is called to allow correct clean up.

Definition at line 19 of file Runnable.h.

Constructor & Destructor Documentation

◆ ~FRunnable()

virtual FRunnable::~FRunnable ( )
inlinevirtual

Virtual destructor

Definition at line 75 of file Runnable.h.

Member Function Documentation

◆ Exit()

virtual void FRunnable::Exit ( )
inlinevirtual

Exits the runnable object.

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

See also
Init, Run, Stop

Reimplemented in FInteractiveProcess, and FMonitoredProcess.

Definition at line 61 of file Runnable.h.

◆ GetSingleThreadInterface()

virtual class FSingleThreadRunnable * FRunnable::GetSingleThreadInterface ( )
inlinevirtual

Gets single thread interface pointer used for ticking this runnable when multi-threading is disabled. If the interface is not implemented, this runnable will not be ticked when FPlatformProcess::SupportsMultithreading() is false.

Returns
Pointer to the single thread interface or nullptr if not implemented.

Reimplemented in FMonitoredProcess, and FAsyncWriter.

Definition at line 69 of file Runnable.h.

◆ Init()

virtual bool FRunnable::Init ( )
inlinevirtual

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 in FThreadHeartBeat, FGameThreadHitchHeartBeatThreaded, FAsyncWriter, FInteractiveProcess, and FMonitoredProcess.

Definition at line 32 of file Runnable.h.

◆ Run()

virtual uint32 FRunnable::Run ( )
pure virtual

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

Implemented in FThreadHeartBeat, FGameThreadHitchHeartBeatThreaded, FAsyncWriter, FInteractiveProcess, and FMonitoredProcess.

◆ Stop()

virtual void FRunnable::Stop ( )
inlinevirtual

Stops the runnable object.

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

See also
Init, Run, Exit

Reimplemented in FThreadHeartBeat, FGameThreadHitchHeartBeatThreaded, FAsyncWriter, FInteractiveProcess, and FMonitoredProcess.

Definition at line 53 of file Runnable.h.


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