From: Paul Floyd Date: Mon, 23 May 2022 19:27:58 +0000 (+0200) Subject: Add small sleep to none/tests/pth_2sig to help prevent hanging X-Git-Tag: VALGRIND_3_20_0~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4151207a28b506cdd1e7c095e4aebaaf289a384;p=thirdparty%2Fvalgrind.git Add small sleep to none/tests/pth_2sig to help prevent hanging On FreeBSD 13.0 x86 this testcase was hanging on some systems. It seems like the SIGTERM signals were not being recieved before the child exited, which left the parent hanging in the pause() waiting to be killed. Reported, patch provided and tested by Nick Briggs. --- diff --git a/none/tests/pth_2sig.c b/none/tests/pth_2sig.c index 56e6904c01..31cd710ce9 100644 --- a/none/tests/pth_2sig.c +++ b/none/tests/pth_2sig.c @@ -14,6 +14,7 @@ void *slavethread(void *arg) int main(int argc, char **argv) { + const struct timespec alittle = { 0, 1000000000 / 100 }; // 0.01 seconds. int i; for (i = 0; i < 10; i++) { pthread_t slave; @@ -28,7 +29,7 @@ int main(int argc, char **argv) case 0: // child sleep(2); // Should be enough to ensure (some) threads are created for (i = 0; i < 20 && kill(pid, SIGTERM) == 0; i++) - ; + nanosleep(&alittle, NULL); exit(0); case -1: perror("fork");