From ca5b257835578d98145becbc3d97505394a7726c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 13 Oct 2013 15:10:53 +0200 Subject: add APT::Progress::PackageManager::Pulse() --- apt-pkg/deb/dpkgpm.cc | 5 +++-- apt-pkg/iprogress.h | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 0c3be4ce5..d617a3c0c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1364,13 +1364,14 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) FD_SET(_dpkgin, &rfds); if(master >= 0) FD_SET(master, &rfds); - tv.tv_sec = 1; - tv.tv_nsec = 0; + tv.tv_sec = 0; + tv.tv_nsec = d->progress->GetPulseInterval(); select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv, &original_sigmask); if (select_ret < 0 && (errno == EINVAL || errno == ENOSYS)) select_ret = racy_pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv, &original_sigmask); + d->progress->Pulse(); if (select_ret == 0) continue; else if (select_ret < 0 && errno == EINTR) diff --git a/apt-pkg/iprogress.h b/apt-pkg/iprogress.h index 6519e9445..04520ffe8 100644 --- a/apt-pkg/iprogress.h +++ b/apt-pkg/iprogress.h @@ -28,7 +28,12 @@ namespace Progress { virtual void Finished() {}; virtual pid_t fork() {return fork(); }; - + + virtual void Pulse() {}; + virtual long GetPulseInterval() { + return 500000; + }; + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, -- cgit v1.2.3