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

Localize the start event

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac335@3260 e5f2f494-b856-4b98-b285-d166d9295462
parent 8b67cc82
...@@ -149,11 +149,11 @@ class NotifyOut: ...@@ -149,11 +149,11 @@ class NotifyOut:
self.notify_num += 1 self.notify_num += 1
self._notifying_zones.append(zone_id) self._notifying_zones.append(zone_id)
def _dispatcher(self): def _dispatcher(self, started_event):
while self._serving: while self._serving:
# Let the master know we are alive already # Let the master know we are alive already
if self._started_event: if started_event:
self._started_event.set() started_event.set()
replied_zones, not_replied_zones = self._wait_for_notify_reply() replied_zones, not_replied_zones = self._wait_for_notify_reply()
...@@ -183,18 +183,18 @@ class NotifyOut: ...@@ -183,18 +183,18 @@ class NotifyOut:
# Prepare for launch # Prepare for launch
self._serving = True self._serving = True
self._started_event = threading.Event()
self._read_sock, self._write_sock = socket.socketpair() self._read_sock, self._write_sock = socket.socketpair()
started_event = threading.Event()
# Start # Start
self._thread = threading.Thread(target=self._dispatcher, args=()) self._thread = threading.Thread(target=self._dispatcher,
args=[started_event])
if daemon: if daemon:
self._thread.daemon = daemon self._thread.daemon = daemon
self._thread.start() self._thread.start()
# Wait for it to get started # Wait for it to get started
self._started_event.wait() started_event.wait()
self._started_event = None
# Return it to anyone listening # Return it to anyone listening
return self._thread 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