diff options
| author | Stephan Peijnik <debian@sp.or.at> | 2009-07-03 13:16:27 +0200 |
|---|---|---|
| committer | Stephan Peijnik <debian@sp.or.at> | 2009-07-03 13:16:27 +0200 |
| commit | 2e2d8f93cdcfc61655bc0895380b33cfa4c78e9f (patch) | |
| tree | 9f3cd4ec2977ac5f4693a8883166529ca6a9a974 /python/progress.cc | |
| parent | 4882fc138b9439469bb934f2db659bc97f131725 (diff) | |
| parent | 59b0a9ccf0b81a0a13ed10f4ceee28b24cfbb85c (diff) | |
| download | python-apt-2e2d8f93cdcfc61655bc0895380b33cfa4c78e9f.tar.gz | |
Further work on threading support.
Fixed bug that prevented building with Python 2.4.
Diffstat (limited to 'python/progress.cc')
| -rw-r--r-- | python/progress.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/python/progress.cc b/python/progress.cc index 027a51b4..cbb49671 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -336,15 +336,19 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) void PyInstallProgress::StartUpdate() { RunSimpleCallback("startUpdate"); + PyCbObj_BEGIN_ALLOW_THREADS } void PyInstallProgress::UpdateInterface() { + PyCbObj_END_ALLOW_THREADS RunSimpleCallback("updateInterface"); + PyCbObj_BEGIN_ALLOW_THREADS } void PyInstallProgress::FinishUpdate() { + PyCbObj_END_ALLOW_THREADS RunSimpleCallback("finishUpdate"); } @@ -403,9 +407,9 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) _exit(res); } - StartUpdate(); + PyCbObj_END_ALLOW_THREADS if(PyObject_HasAttrString(callbackInst, "waitChild")) { PyObject *method = PyObject_GetAttrString(callbackInst, "waitChild"); //std::cerr << "custom waitChild found" << std::endl; @@ -420,14 +424,19 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) int child_res; if(!PyArg_Parse(result, "i", &res) ) { std::cerr << "custom waitChild() result could not be parsed?"<< std::endl; + PyCbObj_BEGIN_ALLOW_THREADS return pkgPackageManager::Failed; } + PyCbObj_BEGIN_ALLOW_THREADS //std::cerr << "got child_res: " << res << std::endl; } else { //std::cerr << "using build-in waitpid()" << std::endl; - - while (waitpid(child_id, &ret, WNOHANG) == 0) + PyCbObj_BEGIN_ALLOW_THREADS + while (waitpid(child_id, &ret, WNOHANG) == 0) { + PyCbObj_END_ALLOW_THREADS UpdateInterface(); + PyCbObj_BEGIN_ALLOW_THREADS + } res = (pkgPackageManager::OrderResult) WEXITSTATUS(ret); //std::cerr << "build-in waitpid() got: " << res << std::endl; |
