Add unp_dispose() threads to 'unsopassgc' test.
authormvs <mvs@openbsd.org>
Wed, 29 Dec 2021 00:04:35 +0000 (00:04 +0000)
committermvs <mvs@openbsd.org>
Wed, 29 Dec 2021 00:04:35 +0000 (00:04 +0000)
regress/sys/kern/unixsockets/unsopassgc.c

index 9f5d72f..ecce985 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: unsopassgc.c,v 1.3 2021/12/15 22:29:55 mvs Exp $ */
+/* $OpenBSD: unsopassgc.c,v 1.4 2021/12/29 00:04:35 mvs Exp $ */
 
 /*
  * Copyright (c) 2021 Vitaliy Makkoveev <mvs@openbsd.org>
@@ -183,6 +183,20 @@ thr_recv(void *arg)
        return NULL;
 }
 
+static void *
+thr_dispose(void *arg)
+{
+       uint8_t buf[sizeof(union msg_control)];
+       int *s = ((struct thr_pass_arg *)arg)->s;
+
+       while (1) {
+               if (read(s[1], buf, sizeof(buf)) < 0)
+                       therr(1, "read");
+       }
+
+       return NULL;
+}
+
 static void *
 thr_gc(void *arg)
 {
@@ -280,6 +294,10 @@ main(int argc, char *argv[])
                    thr_recv, &thr_pass_args[i]);
                if (error)
                        therrc(1, error, "pthread_create");
+               error = pthread_create(&thr, NULL,
+                   thr_dispose, &thr_pass_args[i]);
+               if (error)
+                       therrc(1, error, "pthread_create");
        }
 
        if ((error = pthread_create(&thr, NULL, thr_gc, thr_gc_arg)))