Merge "Fix inconsistent interface of ThreadGroup"

This commit is contained in:
Zuul
2025-07-03 16:22:50 +00:00
committed by Gerrit Code Review

View File

@@ -22,8 +22,6 @@ from oslo_service.backend.threading import loopingcall
LOG = logging.getLogger(__name__)
# --- New: Add a Thread wrapper to mimic the eventlet interface ---
class Thread:
"""A simple wrapper around native threads.
@@ -63,8 +61,6 @@ class Thread:
# Optionally implement cancellation if required.
pass
# --- End of new Thread wrapper ---
class ThreadGroup:
"""A group of threads and timers similar to eventlet's GreenPool."""
@@ -215,6 +211,9 @@ class ThreadGroup:
self.threads = [t for t in self.threads if t is current]
def waitall(self):
"""Block until all timers and threads in the group are complete.
"""
with self._lock:
threads_copy = list(self.threads)
timers_copy = list(self.timers)
@@ -225,6 +224,9 @@ class ThreadGroup:
for timer in timers_copy:
timer.wait()
# NOTE(tkajinam): To keep interface consistent with eventlet version
wait = waitall
def _set_attr(self, obj, attr, value):
try:
object.__setattr__(obj, attr, value)