mldonkey-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-devel] [PATCH]Ordered list of timers


From: Fortin Denis
Subject: [Mldonkey-devel] [PATCH]Ordered list of timers
Date: Tue, 03 Feb 2004 18:50:04 +0100

This patch change the list of timers in basicSocket.ml to be an ordered
list sorted by next_time order. 

Without this patch we iter through the list of timers to 
1) get the minimum timeout 
2) execute expired timers.
We do this for every iteration of the loop() function.
The problem is that some loop iterations don't match an expiration of a
timer, but a read/write/timeout event on sockets. 

With this patch getting the minimun timeout is O(1) and we stop
iterating immediately if there's no timer to execute. 
The counter part is that it's slower to insert / reactivate a timer.

This patch is probably a little useless for the moment (there's only ~30
timers for the edonkey plugin), but maybe in the future, more clever 
strategies (http://citeseer.nj.nec.com/varghese96hashed.html) will
be needed.

It should work with every recent CVS version.

NB : I removed the select() call in the loop function in this patch

Denis Fortin


Attachment: ordered.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]