After the libevent has timed out,
The while loop once from the heap top del timer--until the most recently adjusted minimum heap top is not a timeout event (actually del event), but will later put this timeout's event into the active task list,
Wait for processing, the event is marked as timeout, and so on when the Actvie queue is processed by the application layer callback function to determine what to do with events marked as timeout.
Nginx processing Timeout, directly delete the red and black tree (in the event structure) of the RB node member, while calling the application layer has already passed the Add Timer registration good timeout handler function. The reason why the heap is not used
Because nodes are removed directly from the inside each time, instead of the top of the heap.
Key points, the heap is used, the deletion time is O (1), but to adjust the heap, Logn. The insertion time is basically LGN.
Using a red-black tree, deleting a node is 3 rotations, but finding the smallest node is logn. The insertion time is basically LGN.
Overall, it's pretty much the same. Http://blog.sina.com.cn/s/blog_56e6a0750101b0fo.html
Timer management: Nginx's red-black tree and Libevent heap