For a worker thread I am using the following "simple" logic
void App::RenderThreadFct()
{
while(m_TerminateRenderThread == false){
...
}
}
with m_TerminateRenderThread
being a volatile variable.
What confuses me a little was digging through the fancy C++ documentation for all the new features for multithreading like std::future
, std::promise
and god knows what else.
While all these for sure have their legitimation, they look total overkill to me to tackle such a "simple" problem.
But Internet searches totally confused me as they gave me solely solutions of that kind for doing it "properly" in C++.
Am I missing something and is there any reason why I should not check in a worker thread for a simple termination flag (which of course must be volatile)?