bool ok = true;
const int num_threads = 64;
pthread_t threads[num_threads];
+ sigset_t set;
int i;
#ifndef HAVE_PTHREAD
torture_skip(tctx, "no pthread support\n");
#endif
+ /*
+ * Be nasty and taste for the worst case: ensure all threads start with
+ * SIGCHLD unblocked so we have the most fun with SIGCHLD being
+ * delivered to a random thread. :)
+ */
+ sigemptyset(&set);
+ sigaddset(&set, SIGCHLD);
+#ifdef HAVE_PTHREAD
+ ret = pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+#else
+ ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
+#endif
+ if (ret != 0) {
+ return -1;
+ }
+
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&threads[i], NULL, tfork_thread, NULL);
torture_assert_goto(tctx, ret == 0, ok, done,