Home | History | Annotate | Line # | Download | only in c
      1 /* Check that TRT happens at an non-abort ignored signal, more than one thread.
      2 #progos: linux
      3 #cc: additional_flags=-pthread
      4 */
      5 
      6 #include <stdlib.h>
      7 #include <stddef.h>
      8 #include <stdio.h>
      9 #include <unistd.h>
     10 #include <pthread.h>
     11 #include <sys/types.h>
     12 #include <signal.h>
     13 
     14 static void *
     15 process (void *arg)
     16 {
     17   int i;
     18   for (i = 0; i < 100; i++)
     19     sched_yield ();
     20   return NULL;
     21 }
     22 
     23 int main (void)
     24 {
     25   pthread_t th_a;
     26   int retcode;
     27   void *retval;
     28   signal (SIGALRM, SIG_IGN);
     29   if (pthread_create (&th_a, NULL, process, (void *) "a") == 0)
     30     kill (getpid (), SIGALRM);
     31   retcode = pthread_join (th_a, &retval);
     32   if (retcode != 0 || retval != NULL)
     33     abort ();
     34   printf ("pass\n");
     35   exit (0);
     36 }
     37