BIND 10 trac2855, updated. b7c2bcca4fb95fbaf48835fcebd45b3934f1ad74 [2855] Add more code comments
BIND 10 source code commits
bind10-changes at lists.isc.org
Sun Jun 23 18:57:32 UTC 2013
The branch, trac2855 has been updated
via b7c2bcca4fb95fbaf48835fcebd45b3934f1ad74 (commit)
from f801e1bb33d3853a53784094c3eb2d71c0d45315 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b7c2bcca4fb95fbaf48835fcebd45b3934f1ad74
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon Jun 24 00:27:11 2013 +0530
[2855] Add more code comments
-----------------------------------------------------------------------
Summary of changes:
src/bin/memmgr/memmgr.py.in | 8 ++++++++
src/bin/memmgr/tests/memmgr_test.py | 5 +++++
2 files changed, 13 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/bin/memmgr/memmgr.py.in b/src/bin/memmgr/memmgr.py.in
index f760a88..bf11991 100755
--- a/src/bin/memmgr/memmgr.py.in
+++ b/src/bin/memmgr/memmgr.py.in
@@ -133,10 +133,13 @@ class Memmgr(BIND10Server):
pass
def __create_builder_thread(self):
+ # We get responses from the builder thread on this socket pair.
(self._master_sock, self._builder_sock) = \
socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
self.watch_fileno(self._master_sock, rcallback=self.__notify_from_builder)
+ # See the documentation for MemorySegmentBuilder on how the
+ # following are used.
self._builder_cv = threading.Condition()
self._builder_lock = threading.Lock()
@@ -151,17 +154,22 @@ class Memmgr(BIND10Server):
self._builder_setup = True
def __shutdown_builder_thread(self):
+ # Some unittests do not create the builder thread, so we check
+ # that.
if not self._builder_setup:
return
self._builder_setup = False
+ # This makes the MemorySegmentBuilder exit its main loop. It
+ # should make the builder thread joinable.
with self._builder_cv:
with self._builder_lock:
self._builder_command_queue.append('shutdown')
self._builder_cv.notify_all()
self._builder_thread.join()
+
self._master_sock.close()
self._builder_sock.close()
diff --git a/src/bin/memmgr/tests/memmgr_test.py b/src/bin/memmgr/tests/memmgr_test.py
index e01e031..45b8185 100755
--- a/src/bin/memmgr/tests/memmgr_test.py
+++ b/src/bin/memmgr/tests/memmgr_test.py
@@ -76,8 +76,13 @@ class TestMemmgr(unittest.TestCase):
self.__orig_isdir = os.path.isdir
def tearDown(self):
+ # Not all unittests cause this method to be called, so we call
+ # it explicitly as it may be necessary in some cases where the
+ # builder thread has been created.
self.__mgr._shutdown_module()
+ # Assert that all commands sent to the builder thread were
+ # handled.
self.assertEqual(len(self.__mgr._builder_command_queue), 0)
# Restore faked values
More information about the bind10-changes
mailing list