about summary refs log tree commit diff
path: root/linuxthreads/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/sysdeps')
-rw-r--r--linuxthreads/sysdeps/pthread/posix-timer.h3
-rw-r--r--linuxthreads/sysdeps/pthread/timer_getoverr.c4
-rw-r--r--linuxthreads/sysdeps/pthread/timer_routines.c12
3 files changed, 14 insertions, 5 deletions
diff --git a/linuxthreads/sysdeps/pthread/posix-timer.h b/linuxthreads/sysdeps/pthread/posix-timer.h
index 7a2caf28a4..a7d1856740 100644
--- a/linuxthreads/sysdeps/pthread/posix-timer.h
+++ b/linuxthreads/sysdeps/pthread/posix-timer.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX timer implementation on top of LinuxThreads.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
 
@@ -65,6 +65,7 @@ struct timer_node
   struct thread_node *thread;
   pid_t creator_pid;
   int refcount;
+  int overrun_count;
 };
 
 
diff --git a/linuxthreads/sysdeps/pthread/timer_getoverr.c b/linuxthreads/sysdeps/pthread/timer_getoverr.c
index 204addc85a..4994f8f2e7 100644
--- a/linuxthreads/sysdeps/pthread/timer_getoverr.c
+++ b/linuxthreads/sysdeps/pthread/timer_getoverr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
 
@@ -37,7 +37,7 @@ timer_getoverrun (timerid)
   if (! timer_valid (timer = timer_id2ptr (timerid)))
     __set_errno (EINVAL);
   else
-    retval = 0; /* TODO: overrun counting not supported */
+    retval = timer->overrun_count;
 
   pthread_mutex_unlock (&__timer_mutex);
 
diff --git a/linuxthreads/sysdeps/pthread/timer_routines.c b/linuxthreads/sysdeps/pthread/timer_routines.c
index 85d626b0f4..6eae476cf5 100644
--- a/linuxthreads/sysdeps/pthread/timer_routines.c
+++ b/linuxthreads/sysdeps/pthread/timer_routines.c
@@ -1,5 +1,5 @@
 /* Helper code for POSIX timer implementation on LinuxThreads.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
 
@@ -413,8 +413,16 @@ thread_func (void *arg)
 	      if (__builtin_expect (timer->value.it_interval.tv_sec, 0) != 0
 		  || timer->value.it_interval.tv_nsec != 0)
 		{
-		  timespec_add (&timer->expirytime, &now,
+		  timer->overrun_count = 0;
+		  timespec_add (&timer->expirytime, &timer->expirytime,
 				&timer->value.it_interval);
+		  while (timespec_compare(&timer->expirytime, &now) < 0)
+		    {
+		      timespec_add (&timer->expirytime, &timer->expirytime,
+				    &timer->value.it_interval);
+		      if (timer->overrun_count < DELAYTIMER_MAX)
+			++timer->overrun_count;
+		    }
 		  __timer_thread_queue_timer (self, timer);
 		}