Berserk
Public Types | Public Member Functions | List of all members
Thread Class Referencefinal

Represents thread wrapper used to enqueue commands to execute. More...

#include <Thread.hpp>

Public Types

enum class  Flag { Before , Update , After }
 Flag to enqueue callback. More...
 
using Callable = std::function< void()>
 Thread callback function type. More...
 

Public Member Functions

BRK_API Thread ()=default
 
BRK_API ~Thread ()
 
BRK_API void Enqueue (Callable callable, Flag flag)
 
BRK_API void EnqueueBefore (Callable callable)
 
BRK_API void EnqueueUpdate (Callable callable)
 
BRK_API void EnqueueAfter (Callable callable)
 
BRK_API void Update ()
 
BRK_API void ExecuteBefore ()
 
BRK_API void ExecuteUpdate ()
 
BRK_API void ExecuteAfter ()
 
BRK_API bool OnThread () const
 

Detailed Description

Represents thread wrapper used to enqueue commands to execute.

Template Parameters
TArgsArgs to call callbacks

Member Typedef Documentation

◆ Callable

using Thread::Callable = std::function<void()>

Thread callback function type.

Member Enumeration Documentation

◆ Flag

enum Thread::Flag
strong

Flag to enqueue callback.

Enumerator
Before 

Execute before thread main update

Update 

Execute middle thread main update

After 

Execute after thread main update

Constructor & Destructor Documentation

◆ Thread()

BRK_API Thread::Thread ( )
default

◆ ~Thread()

BRK_NS_BEGIN Thread::~Thread ( )

Member Function Documentation

◆ Enqueue()

void Thread::Enqueue ( Thread::Callable  callable,
Thread::Flag  flag 
)

Enqueue command to execute on thread

◆ EnqueueAfter()

BRK_API void Thread::EnqueueAfter ( Callable  callable)
inline

Enqueue command to execute on thread after update

◆ EnqueueBefore()

BRK_API void Thread::EnqueueBefore ( Callable  callable)
inline

Enqueue command to execute on thread before update

◆ EnqueueUpdate()

BRK_API void Thread::EnqueueUpdate ( Callable  callable)
inline

Enqueue command to execute on thread in update

◆ ExecuteAfter()

void Thread::ExecuteAfter ( )
Note
Internal: must be called on thread

◆ ExecuteBefore()

void Thread::ExecuteBefore ( )
Note
Internal: must be called on thread

◆ ExecuteUpdate()

void Thread::ExecuteUpdate ( )
Note
Internal: must be called on thread

◆ OnThread()

bool Thread::OnThread ( ) const
Returns
True if currently on this thread

◆ Update()

void Thread::Update ( )
Note
Internal: must be called on thread

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