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.
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;
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");