tst-cancel31 fail on la32 qemu-system with a single-core
system sometimes.
IF the test and a infinite loop run on a same x86_64 core,
the test also fail sometimes.
taskset -c 0 make test t=nptl/tst-cancel31
taskset -c 0 ./a.out (a.out is a infinite loop)
After writeopener thread opens the file, it may switch to
main thread and find redundant files.
pthread_cancel and pthread_join writeopener thread
before support_descriptors_check.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
for (;;)
{
fd = open (arg, O_WRONLY);
+ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, 0);
xclose (fd);
+ pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
}
return NULL;
}
srand (1);
- xpthread_create (NULL, writeopener, name);
+ pthread_t tw = xpthread_create (NULL, writeopener, name);
for (int i = 0; i < iter_count; i++)
{
pthread_t td = xpthread_create (NULL, leaker, name);
xpthread_join (td);
}
+ pthread_cancel (tw);
+ xpthread_join (tw);
+
support_descriptors_check (descrs);
support_descriptors_free (descrs);