mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 06:32:31 +00:00
* 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:
+8
-6
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user