(pthread_key_delete): Check th->p_terminated to see if the thread is running.