(handlers)
| 22 | import select |
| 23 | |
| 24 | def event_loop(handlers): |
| 25 | while True: |
| 26 | wants_recv = [h for h in handlers if h.wants_to_receive()] |
| 27 | wants_send = [h for h in handlers if h.wants_to_send()] |
| 28 | can_recv, can_send, _ = select.select(wants_recv, wants_send, []) |
| 29 | for h in can_recv: |
| 30 | h.handle_receive() |
| 31 | for h in can_send: |
| 32 | h.handle_send() |
no test coverage detected