Equivalent to asyncio.gather or Thread.join()
(*ts, return_exceptions=False, timeout=None)
| 60 | |
| 61 | |
| 62 | def gather(*ts, return_exceptions=False, timeout=None): |
| 63 | """ |
| 64 | Equivalent to asyncio.gather or Thread.join() |
| 65 | """ |
| 66 | if ts and inspect.isawaitable(ts[0]): |
| 67 | rv: Any = asyncio.gather(*ts, return_exceptions=return_exceptions) |
| 68 | if timeout is None: |
| 69 | rv = asyncio.wait_for(rv, timeout) |
| 70 | return rv |
| 71 | else: |
| 72 | for t in ts: |
| 73 | t.join(timeout) |
| 74 | assert not t.is_alive() |
| 75 | |
| 76 | |
| 77 | def asleep(s): |