In my destructor I want to destroy a thread cleanly.
My goal is to wait for a thread to finish executing and THEN destroy the thread.
The only thing I found about querying the state of a pthread is pthread_attr_setdetachstate but this only tells you if your thread is:
Both of those have nothing to do with whether the thread is still running or not.
How do you query a pthread to see if it is still running?