diff options
| author | Scott Gasch <[email protected]> | 2021-09-07 22:20:40 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-09-07 22:20:40 -0700 |
| commit | b10d30a46e601c9ee1f843241f2d69a1f90f7a94 (patch) | |
| tree | 30c95e6f4333b57ff3ae7a4dee278b2097612d10 /smart_future.py | |
| parent | f49bb9db0c6d1a8622dca1717db68462a4209112 (diff) | |
Various changes.
Diffstat (limited to 'smart_future.py')
| -rw-r--r-- | smart_future.py | 10 |
1 files changed, 10 insertions, 0 deletions
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. |
