Ticket #400: race2.patch

File race2.patch, 1.3 KB (added by jinmei, 9 years ago)
  • zonemgr.py.in

     
    325325
    326326    def _run_timer(self, start_event):
    327327        start_event.set()
    328         while self._running:
     328        while True:
    329329            # If zonemgr has no zone, set timer timeout to self._lowerbound_retry.
    330330            if self._zone_mgr_is_empty():
    331331                timeout = self._lowerbound_retry
     
    352352                    break
    353353
    354354            for fd in rlist:
    355                 if fd == self._read_sock: # awaken by shutdown socket
    356                     # self._running will be False by now, if it is not a false
    357                     # alarm
    358                     continue
     355                if fd == self._read_sock: # awaken by shutdown socket
     356                    return
    359357                if fd == self._check_sock: # awaken by check socket
    360358                    self._check_sock.recv(32)
    361359
     
    392390        """
    393391        if not self._running:
    394392            raise RuntimeError("Trying to shutdown, but not running")
     393        self._running = False
    395394
    396395        # Ask the thread to stop
    397         self._running = False
    398396        self._write_sock.send(b'shutdown') # make self._read_sock readble
    399397        # Wait for it to actually finnish
    400398        self._thread.join()