use atomic::exchange() to fix minor race in ProgressMonitor