added timeout to pauseall/resumeall for sleep function