5#include <Common/debug.h>
6#include <Common/exceptions.h>
7#include <Common/logging.h>
34 template<
typename Func,
typename... Args>
67 std::thread::id
getId()
const;
72 void setPromisedValue(
bool value);
73 bool isEmptyThread()
const;
76 std::promise<bool> m_startPromise;
81template<
typename Func,
typename... Args>
85 m_thread = std::thread(
86 [startFuture = m_startPromise.get_future(),
87 func = std::bind(std::forward<Func>(func), std::forward<Args>(args)...)]
97 catch(
const Exception& e)
100 "[InitiallyPausedThread] unhandled exception thrown: {}", e.what());
107inline bool InitiallyPausedThread::hasStarted()
const
112inline bool InitiallyPausedThread::hasJoined()
const
117inline std::thread::id InitiallyPausedThread::getId()
const
119 return m_thread.get_id();
122inline bool InitiallyPausedThread::isEmptyThread()
const
124 return m_thread.get_id() == std::thread::id();
Marks the derived class as move only.
Definition IMoveOnly.h:23
Definition InitiallyPausedThread.h:18
std::thread::id getId() const
Get ID of the underlying thread.
Definition InitiallyPausedThread.h:117
bool hasStarted() const
Whether the thread has started executing the functor. The started state is visible to the body of the...
Definition InitiallyPausedThread.h:107
bool hasJoined() const
Whether the thread has joined.
Definition InitiallyPausedThread.h:112
~InitiallyPausedThread()
Definition InitiallyPausedThread.cpp:64
InitiallyPausedThread & operator=(InitiallyPausedThread &&rhs)=default
void join()
Wait until the execution of the thread is finished. hasStarted() must be true when calling this metho...
Definition InitiallyPausedThread.cpp:34
void start()
Start the execution of the thread. This method synchronizes-with the start of the call to the functor...
Definition InitiallyPausedThread.cpp:18
InitiallyPausedThread()
An empty object that does not represent a thread.
Definition InitiallyPausedThread.cpp:11
InitiallyPausedThread(InitiallyPausedThread &&other)=default
The root for all renderer implementations.
Definition EEngineProject.h:6