* sysdeps/alpha/bits/atomic.h (__arch_compare_and_exchange_xxx_8_int): ...
[glibc.git] / rt / tst-timer2.c
blob74ccc492b0f27a856c8f855ebaf1966bddce2002
1 /* Test for crashing bugs when trying to create too many timers. */
3 #include <stdio.h>
4 #include <time.h>
5 #include <signal.h>
6 #include <sys/time.h>
7 #include <sys/resource.h>
8 #include <unistd.h>
10 #if _POSIX_THREADS
11 # include <pthread.h>
13 void
14 thread (union sigval arg)
16 puts ("Timeout");
19 int
20 do_test (void)
22 int i, res;
23 timer_t timerId;
24 struct itimerspec itval;
25 struct sigevent sigev;
27 itval.it_interval.tv_sec = 2;
28 itval.it_interval.tv_nsec = 0;
29 itval.it_value.tv_sec = 2;
30 itval.it_value.tv_nsec = 0;
32 sigev.sigev_notify = SIGEV_THREAD;
33 sigev.sigev_signo = SIGRTMIN;
34 sigev.sigev_notify_function = thread;
35 sigev.sigev_notify_attributes = 0;
36 sigev.sigev_value.sival_ptr = (void *) &timerId;
38 for (i = 0; i < 100; i++)
40 printf ("cnt = %d\n", i);
42 if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0)
43 perror ("timer_create");
45 res = timer_settime (timerId, 0, &itval, NULL);
46 if (res < 0)
47 perror ("timer_settime");
49 res = timer_delete (timerId);
50 if (res < 0)
51 perror ("timer_delete");
54 return 0;
57 # define TEST_FUNCTION do_test ()
58 #else
59 # define TEST_FUNCTION 0
60 #endif
62 #include "../test-skeleton.c"