These are the steps of the Trio event loop:
- Compute timeout (0 if still tasks in
runqi.e. the list of tasks ready to resume, elseclock.deadline_to_sleep_time(deadlines.next_deadline())) - Wait for IO events or timeout (
events = io_manager.get_events(timeout)) – this is the actualselect()-like call. - Events are "processed" i.e. scheduled into the relevant task (
io_manager.process_events(events)which calls_core.reschedule(self._registered[key], outcome.Value(event))i.e. added torunq) - Deadlines are expired (
deadlines.expire(clock.current_time()), which effectively callstask.reschedule(Cancelled)(via the task's abort function) i.e. adds the task to therunq)