aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/pthread/tst-timer.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-25 01:14:36 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-25 01:14:36 +0000
commit5e826ab537a668c9486deecc3d7fc1cbe1abda2a (patch)
tree4c9a15802afe26941eb8fe4172863c7356a41754 /nptl/sysdeps/pthread/tst-timer.c
parentc6289757d6e374904d720ff9d86d304605c952b1 (diff)
downloadglibc-5e826ab537a668c9486deecc3d7fc1cbe1abda2a.tar
glibc-5e826ab537a668c9486deecc3d7fc1cbe1abda2a.tar.gz
glibc-5e826ab537a668c9486deecc3d7fc1cbe1abda2a.tar.bz2
glibc-5e826ab537a668c9486deecc3d7fc1cbe1abda2a.zip
Update.
2003-03-24 Jon Grimm <jgrimm@us.ibm.com> * inet/netinet/in.h: Add IPPROTO_SCTP. 2003-03-24 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/sys/epoll.h (EPOLLET): Define.
Diffstat (limited to 'nptl/sysdeps/pthread/tst-timer.c')
-rw-r--r--nptl/sysdeps/pthread/tst-timer.c74
1 files changed, 58 insertions, 16 deletions
diff --git a/nptl/sysdeps/pthread/tst-timer.c b/nptl/sysdeps/pthread/tst-timer.c
index 7417bcd5f0..54d6b6ae93 100644
--- a/nptl/sysdeps/pthread/tst-timer.c
+++ b/nptl/sysdeps/pthread/tst-timer.c
@@ -1,5 +1,5 @@
/* Tests for POSIX timer implementation.
- Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
@@ -26,9 +26,16 @@
static void
-notify_func (union sigval sigval)
+notify_func1 (union sigval sigval)
{
- puts ("notify_func");
+ puts ("notify_func1");
+}
+
+
+static void
+notify_func2 (union sigval sigval)
+{
+ puts ("notify_func2");
}
@@ -75,7 +82,7 @@ main (void)
retval = clock_gettime (CLOCK_REALTIME, &ts);
sigev2.sigev_notify = SIGEV_THREAD;
- sigev2.sigev_notify_function = notify_func;
+ sigev2.sigev_notify_function = notify_func1;
sigev2.sigev_notify_attributes = NULL;
setvbuf (stdout, 0, _IOLBF, 0);
@@ -88,27 +95,62 @@ main (void)
printf ("clock_getres returned %d, timespec = { %ld, %ld }\n",
retval, ts.tv_sec, ts.tv_nsec);
- timer_create (CLOCK_REALTIME, &sigev1, &timer_sig);
- timer_create (CLOCK_REALTIME, &sigev2, &timer_thr1);
- timer_create (CLOCK_REALTIME, &sigev2, &timer_thr2);
-
- timer_settime (timer_thr1, 0, &itimer2, &old);
- timer_settime (timer_thr2, 0, &itimer3, &old);
+ if (timer_create (CLOCK_REALTIME, &sigev1, &timer_sig) != 0)
+ {
+ printf ("timer_create for timer_sig failed: %m\n");
+ exit (1);
+ }
+ if (timer_create (CLOCK_REALTIME, &sigev2, &timer_thr1) != 0)
+ {
+ printf ("timer_create for timer_thr1 failed: %m\n");
+ exit (1);
+ }
+ sigev2.sigev_notify_function = notify_func2;
+ if (timer_create (CLOCK_REALTIME, &sigev2, &timer_thr2) != 0)
+ {
+ printf ("timer_create for timer_thr2 failed: %m\n");
+ exit (1);
+ }
+
+ if (timer_settime (timer_thr1, 0, &itimer2, &old) != 0)
+ {
+ printf ("timer_settime for timer_thr1 failed: %m\n");
+ exit (1);
+ }
+ if (timer_settime (timer_thr2, 0, &itimer3, &old) != 0)
+ {
+ printf ("timer_settime for timer_thr2 failed: %m\n");
+ exit (1);
+ }
signal (ZSIGALRM, signal_func);
- timer_settime (timer_sig, 0, &itimer1, &old);
-
- timer_delete (-1);
+ if (timer_settime (timer_sig, 0, &itimer1, &old) != 0)
+ {
+ printf ("timer_settime for timer_sig failed: %m\n");
+ exit (1);
+ }
intr_sleep (3);
- timer_delete (timer_sig);
- timer_delete (timer_thr1);
+ if (timer_delete (timer_sig) != 0)
+ {
+ printf ("timer_delete for timer_sig failed: %m\n");
+ exit (1);
+ }
+ if (timer_delete (timer_thr1) != 0)
+ {
+ printf ("timer_delete for timer_thr1 failed: %m\n");
+ exit (1);
+ }
intr_sleep (3);
- timer_delete (timer_thr2);
+ if (timer_delete (timer_thr2) != 0)
+ {
+ printf ("timer_delete for timer_thr2 failed: %m\n");
+ exit (1);
+ }
return 0;
}