mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Avoid the locks dance when reading the connection socket number.
It is a fast and non critical operation, so the lock is not required. Furthermore, called from the wait callback creates a deadlock.
This commit is contained in:
parent
389ad08965
commit
1607f89bb1
|
@ -547,11 +547,7 @@ psyco_conn_fileno(connectionObject *self)
|
|||
|
||||
EXC_IF_CONN_CLOSED(self);
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
pthread_mutex_lock(&(self->lock));
|
||||
socket = (long int)PQsocket(self->pgconn);
|
||||
pthread_mutex_unlock(&(self->lock));
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
return PyInt_FromLong(socket);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user