So assuming I have a thread running, and I want the rest of the code outside of the thread to run without having to worry about the thread's join() function to block the code. Will it be safe to do the following:
thread someThread([&someVariable]
{
ThreadCode(someVariable);
someThread.detach();
});
while(1)
{
RestOfMyCode();
}
Currently I use flags to check if a thread is still running or not, but I feel the above code will be easier to read/troubleshot