Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /tests/join1.c [b035ed] .. [e2fd6e] Maximize Restore

  Switch to side-by-side view

--- a/tests/join1.c
+++ b/tests/join1.c
@@ -9,12 +9,14 @@
 void *
 func(void * arg)
 {
-	Sleep(1000);
+    int i = (int) arg;
 
-	pthread_exit(arg);
+    Sleep(i * 500);
 
-	/* Never reached. */
-	exit(1);
+    pthread_exit(arg);
+
+    /* Never reached. */
+    exit(1);
 }
 
 int
@@ -30,6 +32,9 @@
 	    assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
 	  }
 
+	/* Some threads will finish before they are joined, some after. */
+	Sleep(1000);
+
 	for (i = 0; i < 4; i++)
 	  {
 	    assert(pthread_join(id[i], (void *) &result) == 0);