mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-12 07:10:33 +03:00
GIL-related fixes.
This commit is contained in:
parent
75e7273d85
commit
f4ad71fc1d
|
@ -1,3 +1,9 @@
|
||||||
|
2005-03-29 Federico Di Gregorio <fog@debian.org>
|
||||||
|
|
||||||
|
* psycopg/pqpath.c (pq_is_busy): Staring from bug report from
|
||||||
|
Jason Erickson fixed segfaults due to calling Python function
|
||||||
|
without holding the GIL.
|
||||||
|
|
||||||
2005-03-24 Federico Di Gregorio <fog@debian.org>
|
2005-03-24 Federico Di Gregorio <fog@debian.org>
|
||||||
|
|
||||||
* psycopg/typecast_array.c (typecast_array_tokenize): much better
|
* psycopg/typecast_array.c (typecast_array_tokenize): much better
|
||||||
|
|
|
@ -321,12 +321,15 @@ pq_is_busy(connectionObject *conn)
|
||||||
|
|
||||||
if (PQconsumeInput(conn->pgconn) == 0) {
|
if (PQconsumeInput(conn->pgconn) == 0) {
|
||||||
Dprintf("pq_is_busy: PQconsumeInput() failed");
|
Dprintf("pq_is_busy: PQconsumeInput() failed");
|
||||||
PyErr_SetString(OperationalError, PQerrorMessage(conn->pgconn));
|
|
||||||
pthread_mutex_unlock(&(conn->lock));
|
pthread_mutex_unlock(&(conn->lock));
|
||||||
Py_BLOCK_THREADS;
|
Py_BLOCK_THREADS;
|
||||||
|
PyErr_SetString(OperationalError, PQerrorMessage(conn->pgconn));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&(conn->lock));
|
||||||
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
/* now check for notifies */
|
/* now check for notifies */
|
||||||
while ((pgn = PQnotifies(conn->pgconn)) != NULL) {
|
while ((pgn = PQnotifies(conn->pgconn)) != NULL) {
|
||||||
PyObject *notify;
|
PyObject *notify;
|
||||||
|
@ -340,9 +343,6 @@ pq_is_busy(connectionObject *conn)
|
||||||
PyList_Append(conn->notifies, notify);
|
PyList_Append(conn->notifies, notify);
|
||||||
free(pgn);
|
free(pgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&(conn->lock));
|
|
||||||
Py_END_ALLOW_THREADS;
|
|
||||||
|
|
||||||
return PQisBusy(conn->pgconn);
|
return PQisBusy(conn->pgconn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user