[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8837 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8837 - GNUnet/src/applications/testing |
Date: |
Wed, 19 Aug 2009 23:37:09 -0600 |
Author: nevans
Date: 2009-08-19 23:37:09 -0600 (Wed, 19 Aug 2009)
New Revision: 8837
Modified:
GNUnet/src/applications/testing/remote.c
Log:
threads behaving badly, trying another way
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-08-19 23:25:05 UTC (rev
8836)
+++ GNUnet/src/applications/testing/remote.c 2009-08-20 05:37:09 UTC (rev
8837)
@@ -1221,10 +1221,12 @@
struct threadInfo *threadHead;
struct threadInfo *connectThreadPos;
+ struct GNUNET_ThreadHandle *threads[MAX_CONNECT_THREADS];
int unused;
char *cmd;
int length;
int tempThreadCount;
+ int i;
void *unusedVoid;
globalDotFile = dotOutFile;
@@ -1360,6 +1362,7 @@
while ((pos != NULL) && (ret == GNUNET_OK))
{
+ /*
GNUNET_mutex_lock(connectMutex);
tempThreadCount = threadCount;
GNUNET_mutex_unlock(connectMutex);
@@ -1370,25 +1373,38 @@
tempThreadCount = threadCount;
GNUNET_mutex_unlock(connectMutex);
}
+
connectThreadPos = GNUNET_malloc (sizeof (struct threadInfo));
connectThreadPos->thread =
GNUNET_thread_create (&connect_peer_thread, pos, 1024 * 4);
connectThreadPos->next = threadHead;
threadHead = connectThreadPos;
+ */
+ if (tempThreadCount > MAX_CONNECT_THREADS)
+ {
+ for (i = 0; i < tempThreadCount; i++)
+ {
+#if VERBOSE
+ fprintf (stdout, "Joining thread %d...\n", i);
+#endif
+ GNUNET_thread_join (threads[i], &unusedVoid);
+ }
+ tempThreadCount = 0;
+ }
+
+ threads[tempThreadCount] = GNUNET_thread_create
(&connect_peer_thread, pos, 1024 * 4);
pos = pos->next;
}
+/*
connectThreadPos = threadHead;
while (connectThreadPos != NULL)
{
-#if VERBOSE
- fprintf (stdout, "Joining thread...\n");
-#endif
GNUNET_thread_join (connectThreadPos->thread, &unusedVoid);
connectThreadPos = connectThreadPos->next;
}
-
+*/
GNUNET_mutex_destroy (connectMutex);
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8837 - GNUnet/src/applications/testing,
gnunet <=