Adding retry logic to calls that can be interrupted by signal handlers