From 1607f89bb16a4ca55b4923fce02a029953791434 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 7 Apr 2010 02:15:39 +0100 Subject: [PATCH] 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. --- psycopg/connection_type.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 54633051..4004b420 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -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); }