summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-11-23 19:43:52 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-11-23 19:43:52 +0100
commit9fa44c4a7c9ba0b856858b268445bd0f87ee58ae (patch)
treedbc132ab3404a33f5e8c950f62c2a806a4aa3bd3 /python
parente88bce2daf00abe508730e1cd7dd5ef4243ec6f7 (diff)
downloadpython-apt-9fa44c4a7c9ba0b856858b268445bd0f87ee58ae.tar.gz
* python/depcache.cc:
- be more threading friendly
Diffstat (limited to 'python')
-rw-r--r--python/depcache.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/python/depcache.cc b/python/depcache.cc
index 94ff708c..f44f2f32 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -227,17 +227,19 @@ static PyObject *PkgDepCacheGetCandidateVer(PyObject *Self,PyObject *Args)
static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args)
{
+ bool res;
pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self);
char distUpgrade=0;
if (PyArg_ParseTuple(Args,"|b",&distUpgrade) == 0)
return 0;
- bool res;
+ Py_BEGIN_ALLOW_THREADS
if(distUpgrade)
res = pkgDistUpgrade(*depcache);
else
res = pkgAllUpgrade(*depcache);
+ Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return HandleErrors(Py_BuildValue("b",res));
@@ -245,12 +247,15 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args)
static PyObject *PkgDepCacheMinimizeUpgrade(PyObject *Self,PyObject *Args)
{
+ bool res;
pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self);
if (PyArg_ParseTuple(Args,"") == 0)
return 0;
- bool res = pkgMinimizeUpgrade(*depcache);
+ Py_BEGIN_ALLOW_THREADS
+ res = pkgMinimizeUpgrade(*depcache);
+ Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return HandleErrors(Py_BuildValue("b",res));
@@ -351,8 +356,10 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args)
&autoInst, &fromUser) == 0)
return 0;
+ Py_BEGIN_ALLOW_THREADS
pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
depcache->MarkInstall(Pkg, autoInst, 0, fromUser);
+ Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return HandleErrors(Py_None);
@@ -652,23 +659,31 @@ PyObject *GetPkgProblemResolver(PyObject *Self,PyObject *Args)
static PyObject *PkgProblemResolverResolve(PyObject *Self,PyObject *Args)
{
+ bool res;
pkgProblemResolver *fixer = GetCpp<pkgProblemResolver *>(Self);
char brokenFix=1;
if (PyArg_ParseTuple(Args,"|b",&brokenFix) == 0)
return 0;
- bool res = fixer->Resolve(brokenFix);
+ Py_BEGIN_ALLOW_THREADS
+ res = fixer->Resolve(brokenFix);
+ Py_END_ALLOW_THREADS
return HandleErrors(Py_BuildValue("b", res));
}
static PyObject *PkgProblemResolverResolveByKeep(PyObject *Self,PyObject *Args)
-{
+{
+ bool res;
pkgProblemResolver *fixer = GetCpp<pkgProblemResolver *>(Self);
if (PyArg_ParseTuple(Args,"") == 0)
return 0;
- bool res = fixer->ResolveByKeep();
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fixer->ResolveByKeep();
+ Py_END_ALLOW_THREADS
+
return HandleErrors(Py_BuildValue("b", res));
}