pthread_cancel and C++ destructors