* Replaced TaskScheduler with rak::priority_queue.

* Fixed an exception caused by initial hash check not properly
cleaning up HashQueue when canceling.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@606 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-12-08 21:19:53 +00:00
parent ba7d61b532
commit 12ef47da3c
30 changed files with 362 additions and 367 deletions
+8 -6
View File
@@ -220,18 +220,20 @@ main(int argc, char** argv) {
countTicks++;
cachedTime = rak::timer::current();
taskScheduler.execute(cachedTime);
std::list<rak::priority_item*> workQueue;
std::copy(rak::queue_popper(taskScheduler, rak::priority_ready(cachedTime)), rak::queue_popper(), std::back_inserter(workQueue));
std::for_each(workQueue.begin(), workQueue.end(), std::mem_fun(&rak::priority_item::clear_time));
std::for_each(workQueue.begin(), workQueue.end(), std::mem_fun(&rak::priority_item::call));
// This needs to be called every second or so. Currently done by
// the throttle task in libtorrent.
if (!displayScheduler.empty() &&
displayScheduler.get_next_timeout() <= cachedTime)
if (!displayScheduler.empty() && displayScheduler.top()->time() <= cachedTime)
uiControl.display()->do_update();
// Do shutdown check before poll, not after.
uiControl.core()->get_poll_manager()->poll(!taskScheduler.empty() ?
taskScheduler.get_next_timeout() - cachedTime :
60 * 1000000);
uiControl.core()->get_poll_manager()->poll(!taskScheduler.empty() ? taskScheduler.top()->time() - cachedTime : 60 * 1000000);
}
uiControl.cleanup();