]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/worm.c
ncurses 6.3 - patch 20220813
[ncurses.git] / test / worm.c
index 4888a519c8a256ac2b3a5040a5857d9e5b59d0bc..2ce1c5ee3ca258ffe2347a5523ef9ce759d08325 100644 (file)
@@ -53,7 +53,7 @@
   traces will be dumped.  The program stops and waits for one character of
   input at the beginning and end of the interval.
 
-  $Id: worm.c,v 1.84 2022/07/23 17:06:16 tom Exp $
+  $Id: worm.c,v 1.85 2022/08/13 13:28:01 tom Exp $
 */
 
 #include <test.priv.h>
@@ -663,6 +663,15 @@ main(int argc, char *argv[])
 
     Trace(("Cleanup"));
     cleanup();
+#ifdef USE_PTHREADS
+    /*
+     * Do this just in case one of the threads did not really exit.
+     */
+    Trace(("join all threads"));
+    for (n = 0; n < number; n++) {
+       pthread_join(worm[n].thread, NULL);
+    }
+#endif
 #if NO_LEAKS
     for (y = 0; y < max_refs; y++) {
        free(refs[y]);
@@ -672,15 +681,6 @@ main(int argc, char *argv[])
        free(w->xpos);
        free(w->ypos);
     }
-#endif
-#ifdef USE_PTHREADS
-    /*
-     * Do this just in case one of the threads did not really exit.
-     */
-    Trace(("join all threads"));
-    for (n = 0; n < number; n++) {
-       pthread_join(worm[n].thread, NULL);
-    }
 #endif
     ExitProgram(EXIT_SUCCESS);
 }