Polling with timeout, for orderly shutdown.