int RetVal;
#ifdef GLITE_LB_THREADED /* Threaded version */
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d trying to lock the pool ",pthread_self());
+ #endif
RetVal =
pthread_mutex_trylock(
&connectionsHandle.poolLock
);
#ifdef EDG_WLL_CONNPOOL_DEBUG
- printf("Thread %d tring to lock the pool - result %d\n",pthread_self(),RetVal);
+ printf("- result %d\n",RetVal);
#endif
#endif
RetVal = 0;
#ifdef EDG_WLL_CONNPOOL_DEBUG
- printf("Dummy - Locking the pool (pthreads not included)\n");
+ printf("Dummy - Trying to lock the pool (pthreads not included)\n");
#endif
#endif
int RetVal;
#ifdef GLITE_LB_THREADED
- RetVal = pthread_mutex_lock(&connectionsHandle.poolLock);
- printf("Debug out edg_wll_poolLock #2\n");
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d trying to lock the pool\n",pthread_self());
+ #endif
+
+ RetVal = pthread_mutex_trylock(&connectionsHandle.poolLock);
+
+ if (RetVal) {
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d locking the pool\n",pthread_self());
+ #endif
+ RetVal = pthread_mutex_lock(&connectionsHandle.poolLock);
+ }
#ifdef EDG_WLL_CONNPOOL_DEBUG
- printf("Thread %d tring to lock the pool - result %d\n",pthread_self(),RetVal);
+ printf("Thread %d - lock result %d\n",pthread_self(),RetVal);
#endif
#endif
#ifndef GLITE_LB_THREADED
RetVal = 0;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Dummy - Locking the pool (pthreads not included)\n");
+ #endif
#endif
int RetVal;
#ifdef GLITE_LB_THREADED
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d unlocking the pool\n",pthread_self());
+ #endif
RetVal = pthread_mutex_unlock(&connectionsHandle.poolLock);
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d - unlock result %d\n",pthread_self(),RetVal);
+ #endif
+
#endif
#ifndef GLITE_LB_THREADED
RetVal = 0;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Dummy - Unlocking the pool (pthreads not included)\n");
+ #endif
+
#endif
RetVal = pthread_mutex_trylock(&connectionsHandle.connectionLock[index]); /* Try to lock the connection */
if (!RetVal) connectionsHandle.locked_by[index] = (void*)ctx; /* If lock succeeded, store the
locking context address */
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d trying to lock connection No. [%d] - result %d\n",pthread_self(),index,RetVal);
+ #endif
+
#endif
#ifndef GLITE_LB_THREADED
RetVal = 0;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Dummy - Trying to lock connection No. [%d] (pthreads not included)\n",index);
+ #endif
+
#endif
not available)*/
if (!RetVal) connectionsHandle.locked_by[index] = (void*)ctx; /* If lock succeeded, store the
locking context address */
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d locking connection No. [%d] - result %d\n",pthread_self(),index,RetVal);
+ #endif
+
#endif
#ifndef GLITE_LB_THREADED
RetVal = 0;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Dummy - locking connection No. [%d] (pthreads not included)\n",index);
+ #endif
+
#endif
#ifdef GLITE_LB_THREADED
RetVal = pthread_mutex_unlock(&connectionsHandle.connectionLock[index]);
if (!RetVal) connectionsHandle.locked_by[index] = NULL;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Thread %d unlocking connection No. [%d] - result %d\n",pthread_self(),index,RetVal);
+ #endif
+
#endif
#ifndef GLITE_LB_THREADED
RetVal = 0;
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ printf("Dummy - unlocking connection No. [%d] (pthreads not included)\n",index);
+ #endif
+
#endif
OM_uint32 min_stat; /* Does not seem to have any use whatsoever - neither
here nor in edg_wll_FreeContext() */
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ #ifdef GLITE_LB_THREADED
+ printf("Thread %d ",pthread_self());
+ #endif
+ printf("Entering edg_wll_poolFree\n");
+ #endif
- printf("edg_wll_poolFree Checkpoint\n");
for (i=0; i<connectionsHandle.poolSize; i++) {
if (connectionsHandle.connPool[i].peerName) free(connectionsHandle.connPool[i].peerName);
edg_wll_Connections* edg_wll_initConnections() {
- if((connectionsHandle.connPool == NULL) &&
- (connectionsHandle.poolSize > 0)) { /* We need to allocate memory for the connPool and connectionLock arrays */
- connectionsHandle.connPool = (edg_wll_ConnPool *) calloc(connectionsHandle.poolSize, sizeof(edg_wll_ConnPool));
-#ifdef GLITE_LB_THREADED
- connectionsHandle.connectionLock = (pthread_mutex_t *) calloc(connectionsHandle.poolSize, sizeof(pthread_mutex_t));
-#endif
- connectionsHandle.locked_by = (edg_wll_Context) calloc(connectionsHandle.poolSize, sizeof(edg_wll_Context));
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ #ifdef GLITE_LB_THREADED
+ printf("Thread %d ",pthread_self());
+ #endif
+ printf("Entering edg_wll_initConnections\n");
+ #endif
+
+ if((connectionsHandle.connPool == NULL) &&
+ (connectionsHandle.poolSize > 0)) { /* We need to allocate memory for the connPool and connectionLock arrays */
+
+ #ifdef EDG_WLL_CONNPOOL_DEBUG
+ #ifdef GLITE_LB_THREADED
+ printf("Thread %d ",pthread_self());
+ #endif
+ printf("Initializng connections AND THE CONNECTION POOL\n");
+ #endif
+
+
+ connectionsHandle.connPool = (edg_wll_ConnPool *) calloc(connectionsHandle.poolSize, sizeof(edg_wll_ConnPool));
+
+ #ifdef GLITE_LB_THREADED
+ connectionsHandle.connectionLock = (pthread_mutex_t *) calloc(connectionsHandle.poolSize, sizeof(pthread_mutex_t));
+ #endif
+
+ connectionsHandle.locked_by = (edg_wll_Context) calloc(connectionsHandle.poolSize, sizeof(edg_wll_Context));
- }
- if(connectionsHandle.serverConnection == NULL) {
- connectionsHandle.serverConnection = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnPool));
- }
+ }
+ if(connectionsHandle.serverConnection == NULL) {
+ connectionsHandle.serverConnection = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnPool));
+ }
return (&connectionsHandle);