Commit a6c76ef6 authored by Michal Vaner's avatar Michal Vaner
Browse files

Fix race condition in test

It caused distcheck to fail sometimes.

There's still a small race condition, but it is hopefully only
theoretical issue.

Reviewed in jabber room.

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3275 e5f2f494-b856-4b98-b285-d166d9295462
parent 2e733bc5
......@@ -323,7 +323,8 @@ class ZonemgrRefresh:
return False
def _run_timer(self):
def _run_timer(self, start_event):
start_event.set()
while self._running:
# If zonemgr has no zone, set timer timeout to LOWERBOUND_RETRY.
if self._zone_mgr_is_empty():
......@@ -371,12 +372,15 @@ class ZonemgrRefresh:
# Prepare the launch
self._running = True
(self._read_sock, self._write_sock) = socket.socketpair()
start_event = threading.Event()
# Start the thread
self._thread = threading.Thread(target = self._run_timer, args = ())
self._thread = threading.Thread(target = self._run_timer,
args = (start_event,))
if daemon:
self._thread.setDaemon(True)
self._thread.start()
start_event.wait()
# Return the thread to anyone interested
return self._thread
......
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