Analog for pthread_cancel