From b10d30a46e601c9ee1f843241f2d69a1f90f7a94 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Tue, 7 Sep 2021 22:20:40 -0700 Subject: Various changes. --- smart_future.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'smart_future.py') diff --git a/smart_future.py b/smart_future.py index 1c95973..7dbec50 100644 --- a/smart_future.py +++ b/smart_future.py @@ -36,6 +36,16 @@ def wait_any(futures: List[SmartFuture], *, callback: Callable = None): return +def wait_all(futures: List[SmartFuture]) -> None: + done_set = set() + while len(done_set) < len(futures): + for future in futures: + i = future.get_id() + if i not in done_set and future.wrapped_future.done(): + done_set.add(i) + time.sleep(0.1) + + class SmartFuture(DeferredOperand): """This is a SmartFuture, a class that wraps a normal Future and can then be used, mostly, like a normal (non-Future) identifier. -- cgit v1.3