Commit 26595cb4 authored by Jerry's avatar Jerry
Browse files

remove useless threading event


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac335@3166 e5f2f494-b856-4b98-b285-d166d9295462
parent 7cf8eefa
......@@ -103,8 +103,6 @@ class ZonemgrRefresh:
def __init__(self, cc, db_file, slave_socket):
self._cc = cc
self._check_sock = slave_socket
self._runnable = False
self._is_shut_down = threading.Event()
self._read_sock, self._write_sock = socket.socketpair()
self._db_file = db_file
self._zonemgr_refresh_info = {}
......@@ -337,9 +335,8 @@ class ZonemgrRefresh:
"""Keep track of zone timers. The loop can be stopped by calling shutdown() in
another thread.
"""
self._runnable = True
self._is_shut_down.clear()
while self._runnable:
runnable = True
while runnable:
# Zonemgr has no zone.
if self._zone_mgr_is_empty():
time.sleep(LOWERBOUND_RETRY) # A better time?
......@@ -370,18 +367,15 @@ class ZonemgrRefresh:
continue
if self._read_sock in rlist: # awaken by shutdown socket
self._read_sock.recv(32)
runnable = False
continue
if self._check_sock in rlist: # awaken by check socket
self._check_sock.recv(32)
self._is_shut_down.set()
def shutdown(self):
"""Stop the run_timer() loop. Block until the loop has finished. This must be
called when run_timer() is running in another thread, or it will deadlock."""
self._runnable = False
self._write_sock.send(b'shutdown') # make self._read_sock readble
self._is_shut_down.wait()
class Zonemgr:
"""Zone manager class."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment