+ /* First we read those timeouts that have triggered out of the heap. We
+ * keep them in the same order they came out of the heap in. */
+ tt = &timeouts;
+ while(timeout_heap_count(ev->timeouts)
+ && tvle(&timeout_heap_first(ev->timeouts)->when, &now)) {
+ /* This timeout has reached its trigger time; provided it has not been
+ * cancelled we add it to the timeouts list. */
+ t = timeout_heap_remove(ev->timeouts);
+ if(t->active) {
+ *tt = t;
+ tt = &t->next;
+ }
+ }
+ *tt = 0;
+ /* Now we can run the callbacks for those timeouts. They might add further
+ * timeouts that are already in the past but they won't trigger until the
+ * next time round the event loop. */
+ for(t = timeouts; t; t = t->next) {