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:
Daniele Varrazzo 2010-04-07 02:15:39 +01:00
parent 389ad08965
commit 1607f89bb1

View File

@ -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);
}