Extract thread delay helper function.