gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8836 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r8836 - GNUnet/src/applications/testing
Date: Wed, 19 Aug 2009 17:25:06 -0600

Author: nevans
Date: 2009-08-19 17:25:05 -0600 (Wed, 19 Aug 2009)
New Revision: 8836

Modified:
   GNUnet/src/applications/testing/remote.c
Log:
thread safety

Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c    2009-08-19 23:20:33 UTC (rev 
8835)
+++ GNUnet/src/applications/testing/remote.c    2009-08-19 23:25:05 UTC (rev 
8836)
@@ -1224,6 +1224,7 @@
   int unused;
   char *cmd;
   int length;
+  int tempThreadCount;
 
   void *unusedVoid;
   globalDotFile = dotOutFile;
@@ -1354,14 +1355,20 @@
        *  Okay, Combined both solutions for a fix... Just need to test on large
        *  scale testbed (lab) to confirm it actually helps.
        */
-      connectMutex = GNUNET_mutex_create (GNUNET_YES);
+      connectMutex = GNUNET_mutex_create (GNUNET_NO);
       connectFailures = 0;
 
       while ((pos != NULL) && (ret == GNUNET_OK))
         {
-          while (threadCount >= MAX_CONNECT_THREADS)
+          GNUNET_mutex_lock(connectMutex);
+          tempThreadCount = threadCount;
+          GNUNET_mutex_unlock(connectMutex);
+          while (tempThreadCount >= MAX_CONNECT_THREADS)
             {
               GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
+              GNUNET_mutex_lock(connectMutex);
+              tempThreadCount = threadCount;
+              GNUNET_mutex_unlock(connectMutex);
             }
           connectThreadPos = GNUNET_malloc (sizeof (struct threadInfo));
           connectThreadPos->thread =





reply via email to

[Prev in Thread] Current Thread [Next in Thread]