1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| import copy
| import outcome
| from .. import _core
|
|
| # Utility function shared between _io_epoll and _io_windows
| def wake_all(waiters, exc):
| try:
| current_task = _core.current_task()
| except RuntimeError:
| current_task = None
| raise_at_end = False
| for attr_name in ["read_task", "write_task"]:
| task = getattr(waiters, attr_name)
| if task is not None:
| if task is current_task:
| raise_at_end = True
| else:
| _core.reschedule(task, outcome.Error(copy.copy(exc)))
| setattr(waiters, attr_name, None)
| if raise_at_end:
| raise exc
|
|