fix pthread_detach inadvertently acting as cancellation point in race case