avoid deadlock between GIL and scan locks
This commit is contained in:
@ -272,7 +272,9 @@ static PyObject *pyRecord_asyncFinish(pyRecord *self, PyObject *args, PyObject *
|
|||||||
|
|
||||||
static PyObject *pyRecord_enter(pyRecord *self)
|
static PyObject *pyRecord_enter(pyRecord *self)
|
||||||
{
|
{
|
||||||
|
Py_BEGIN_ALLOW_THREADS {
|
||||||
dbScanLock(self->entry.precnode->precord);
|
dbScanLock(self->entry.precnode->precord);
|
||||||
|
} Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
Py_INCREF(self);
|
Py_INCREF(self);
|
||||||
return (PyObject*)self;
|
return (PyObject*)self;
|
||||||
@ -282,8 +284,10 @@ static PyObject *pyRecord_exit(pyRecord *self, PyObject *args)
|
|||||||
{
|
{
|
||||||
PyObject *t, *v, *tb;
|
PyObject *t, *v, *tb;
|
||||||
|
|
||||||
|
Py_BEGIN_ALLOW_THREADS {
|
||||||
/* always unlock, regardless of arguments */
|
/* always unlock, regardless of arguments */
|
||||||
dbScanUnlock(self->entry.precnode->precord);
|
dbScanUnlock(self->entry.precnode->precord);
|
||||||
|
} Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
if(!PyArg_ParseTuple(args, "OOO", &t, &v, &tb))
|
if(!PyArg_ParseTuple(args, "OOO", &t, &v, &tb))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user