summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-01-23 19:21:26 +0100
committerJulian Andres Klode <jak@debian.org>2010-01-23 19:21:26 +0100
commitc654ae4c10bf40922e2ecf8f1b7fe1c2b97a06aa (patch)
tree3a17204be569cbb2131ff1a5913dcda56197476d /python
parente29ff27343b203fd4150d6171efdc7e6ae5a68bf (diff)
downloadpython-apt-c654ae4c10bf40922e2ecf8f1b7fe1c2b97a06aa.tar.gz
* python/progress.cc:
- Fix some threading issues (add some missing PyCbObj_BEGIN_ALLOW_THREADS)
Diffstat (limited to 'python')
-rw-r--r--python/progress.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/progress.cc b/python/progress.cc
index 63d9eede..0fc01085 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -133,6 +133,7 @@ bool PyFetchProgress::MediaChange(string Media, string Drive)
bool res = true;
if(!PyArg_Parse(result, "b", &res)) {
// no return value or None, assume false
+ PyCbObj_BEGIN_ALLOW_THREADS
return false;
}
@@ -201,12 +202,15 @@ void PyFetchProgress::Fail(pkgAcquire::ItemDesc &Itm)
PyCbObj_END_ALLOW_THREADS
if (PyObject_HasAttrString(callbackInst, "fail")) {
RunSimpleCallback("fail", TUPLEIZE(PyAcquire_GetItemDesc(pyAcquire, &Itm)));
+ PyCbObj_BEGIN_ALLOW_THREADS
return;
}
// Ignore certain kinds of transient failures (bad code)
- if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
+ if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
+ PyCbObj_BEGIN_ALLOW_THREADS
return;
+ }
if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
{
@@ -262,8 +266,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
pkgAcquireStatus::Pulse(Owner);
//std::cout << "Pulse" << std::endl;
- if(callbackInst == 0)
+ if(callbackInst == 0) {
+ PyCbObj_BEGIN_ALLOW_THREADS
return false;
+ }
setattr(callbackInst, "last_bytes", "d", LastBytes);
setattr(callbackInst, "current_cps", "d", CurrentCPS);
@@ -496,6 +502,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
if (result == NULL) {
std::cerr << "waitChild method invalid" << std::endl;
PyErr_Print();
+ PyCbObj_BEGIN_ALLOW_THREADS
return pkgPackageManager::Failed;
}
if(!PyArg_Parse(result, "i", &res) ) {