58 IThread() : shouldRun(true), isRunning(false)
Abstract interface of a thread.
Definition Thread.hpp:24
virtual void ThreadUpdate()=0
Executed while the thread is active.
virtual void ThreadInit()=0
Executed while starting the thread.
virtual String GetThreadId()=0
void RegisterThread()
Definition Thread.cpp:46
void RunTasks()
Executed any pending tasks.
Definition Thread.cpp:35
void AddTask(ThreadTask task)
Schedule the supplied task to be executed ont this thread.
Definition Thread.cpp:28
virtual ~IThreadInterface()=default
virtual void ThreadDestroy()=0
Executed when the thread is being stopped.
void UnregisterThread()
Definition Thread.cpp:53
Base class for a thread.
Definition Thread.hpp:56
void Start()
Start the thread.
Definition Thread.cpp:60
void RequestStop()
Request the thread to stop.
Definition Thread.cpp:68
String GetThreadId() override
Definition Thread.cpp:84
bool IsRunning()
Check if the thread is currently running.
Definition Thread.cpp:79
IThread()
Definition Thread.hpp:58
void WaitForStop()
Request the thread to stop and wait for it.
Definition Thread.cpp:73
Container class providing thread-safe access to the internal object.
Definition ThreadSafety.hpp:24
void RunOnThread(String threadId, ThreadTask task)
Definition Thread.cpp:12
Function< void()> ThreadTask
Function type to be ran on another thread.
Definition Thread.hpp:12
std::function< T > Function
Definition Primitives.hpp:19
void Sleep(Duration duration)
Sleep the calling thread by the given duration.
Definition Thread.cpp:5