1 /* Test for bogus per-thread deletion of timers. */
10 #include <sys/resource.h>
16 /* Creating timers in another thread should work too. */
18 do_timer_create (void *arg
)
20 struct sigevent
*const sigev
= arg
;
21 timer_t
*const timerId
= sigev
->sigev_value
.sival_ptr
;
22 if (timer_create (CLOCK_REALTIME
, sigev
, timerId
) < 0)
24 printf ("timer_create: %m\n");
36 struct itimerspec itval
;
37 struct sigevent sigev
;
39 itval
.it_interval
.tv_sec
= 2;
40 itval
.it_interval
.tv_nsec
= 0;
41 itval
.it_value
.tv_sec
= 2;
42 itval
.it_value
.tv_nsec
= 0;
44 sigev
.sigev_notify
= SIGEV_SIGNAL
;
45 sigev
.sigev_signo
= SIGALRM
;
46 sigev
.sigev_value
.sival_ptr
= (void *) &timerId
;
48 for (i
= 0; i
< 100; i
++)
50 printf ("cnt = %d\n", i
);
53 res
= pthread_create (&thr
, NULL
, &do_timer_create
, &sigev
);
56 printf ("pthread_create: %s\n", strerror (res
));
60 res
= pthread_join (thr
, &val
);
63 printf ("pthread_join: %s\n", strerror (res
));
69 res
= timer_settime (timerId
, 0, &itval
, NULL
);
71 printf ("timer_settime: %m\n");
73 res
= timer_delete (timerId
);
75 printf ("timer_delete: %m\n");
81 # define TEST_FUNCTION do_test ()
83 # define TEST_FUNCTION 0
86 #include "../test-skeleton.c"