summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-12-16 15:17:42 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-12-29 22:58:49 +0900
commit8555dda0f2ef8ddaf27a769b67f2c32a96a1a408 (patch)
tree4e18dc48a329da30b2e92151ac0afbc2a3f33d05
parent27b253d06e42e5a79ce00508d8bdade6f53724d4 (diff)
BGPSpeaker/base: Stop child activity by name
This patch enables Activity base to stop the child activity by name. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ryu/services/protocols/bgp/base.py b/ryu/services/protocols/bgp/base.py
index dd658aa7..190118f5 100644
--- a/ryu/services/protocols/bgp/base.py
+++ b/ryu/services/protocols/bgp/base.py
@@ -257,21 +257,24 @@ class Activity(object):
"""
hub.sleep(seconds)
- def _stop_child_activities(self):
+ def _stop_child_activities(self, name=None):
"""Stop all child activities spawn by this activity.
"""
# Makes a list copy of items() to avoid dictionary size changed
# during iteration
for child_name, child in list(self._child_activity_map.items()):
+ if name is not None and name != child_name:
+ continue
LOG.debug('%s: Stopping child activity %s ', self.name, child_name)
if child.started:
child.stop()
+ self._child_activity_map.pop(child_name, None)
def _stop_child_threads(self, name=None):
"""Stops all threads spawn by this activity.
"""
for thread_name, thread in list(self._child_thread_map.items()):
- if not name or thread_name is name:
+ if name is not None and thread_name is name:
LOG.debug('%s: Stopping child thread %s',
self.name, thread_name)
thread.kill()