on the thread that needs to be tested. If the return value is 0, then the thread is alive.
If the return value is ESRCH, then the thread is not alive in the system.
Sample code may look like:
bool is_thread_alive(pthread_t thread_id)
{
int status = pthread_kill(thread_id, 0);
if (status == ESRCH)
return true;
else
return false;
}