Skip to content

Commit

Permalink
Merge "Make wait & stop methods work on all threads"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Dec 9, 2013
2 parents 2abc305 + 76a9417 commit bef520f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions openstack/common/threadgroup.py
Expand Up @@ -87,7 +87,10 @@ def thread_done(self, thread):

def stop(self):
current = greenthread.getcurrent()
for x in self.threads:

# Iterate over a copy of self.threads so thread_done doesn't
# modify the list while we're iterating
for x in self.threads[:]:
if x is current:
# don't kill the current thread.
continue
Expand All @@ -112,7 +115,10 @@ def wait(self):
except Exception as ex:
LOG.exception(ex)
current = greenthread.getcurrent()
for x in self.threads:

# Iterate over a copy of self.threads so thread_done doesn't
# modify the list while we're iterating
for x in self.threads[:]:
if x is current:
continue
try:
Expand Down

0 comments on commit bef520f

Please sign in to comment.