about summary refs log tree commit diff
path: root/nptl/tst-cancel7.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/tst-cancel7.c')
-rw-r--r--nptl/tst-cancel7.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/nptl/tst-cancel7.c b/nptl/tst-cancel7.c
index 54ed2a54ff..e926f4455c 100644
--- a/nptl/tst-cancel7.c
+++ b/nptl/tst-cancel7.c
@@ -115,16 +115,13 @@ do_test (void)
 {
   pthread_t th = xpthread_create (NULL, tf, NULL);
 
-  do
-    nanosleep (&(struct timespec) { .tv_sec = 0, .tv_nsec = 100000000 }, NULL);
-  while (access (pidfilename, R_OK) != 0);
+  /* Wait to cancel until after the pid is written.  */
+  if (sem_wait (sem) != 0)
+    FAIL_EXIT1 ("sem_wait: %m");
 
   xpthread_cancel (th);
   void *r = xpthread_join (th);
 
-  if (sem_wait (sem) != 0)
-    FAIL_EXIT1 ("sem_wait: %m");
-
   FILE *f = xfopen (pidfilename, "r+");
 
   long long ll;