Return a set of all tasks for the loop.
(loop=None)
| 42 | |
| 43 | |
| 44 | def all_tasks(loop=None): |
| 45 | """Return a set of all tasks for the loop.""" |
| 46 | if loop is None: |
| 47 | loop = events.get_running_loop() |
| 48 | # capturing the set of eager tasks first, so if an eager task "graduates" |
| 49 | # to a regular task in another thread, we don't risk missing it. |
| 50 | eager_tasks = list(_eager_tasks) |
| 51 | |
| 52 | return {t for t in itertools.chain(_scheduled_tasks, eager_tasks) |
| 53 | if futures._get_loop(t) is loop and not t.done()} |
| 54 | |
| 55 | |
| 56 | class Task(futures._PyFuture): # Inherit Python Task implementation |