about summary refs log tree commit diff
path: root/linuxthreads/sysdeps/pthread/timer_create.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-10 08:28:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-10 08:28:06 +0000
commit45dc1187ee47bc0ffa9bb7ff7ac49749aaabe413 (patch)
tree79f3540143b070f52eb00aa78d7abf00fd0aa772 /linuxthreads/sysdeps/pthread/timer_create.c
parent15109bd4aa7cef49d08ba0c3939b5389a3b90803 (diff)
downloadglibc-45dc1187ee47bc0ffa9bb7ff7ac49749aaabe413.tar.gz
glibc-45dc1187ee47bc0ffa9bb7ff7ac49749aaabe413.tar.xz
glibc-45dc1187ee47bc0ffa9bb7ff7ac49749aaabe413.zip
Update.
2000-06-10  Kaz Kylheku  <kaz@ashi.footprints.net>

	* sysdeps/pthread/timer_create.c: Thread matching now done on
	clock type as well as thread attributes.
	There are individual global signal-delivering threads for
	different clock types.
	* sysdeps/pthread/posix-timer.h: Likewise.
	* sysdeps/pthread/timer_routines.c: Likewise.

	* sysdeps/pthread/timer_routines.c: Thread allocation and
	deallocation function now remembers to put thread on active
	list and remove from active list. 
	Thus now the feature of binding multiple timers
	to a single thread actually works.
Diffstat (limited to 'linuxthreads/sysdeps/pthread/timer_create.c')
-rw-r--r--linuxthreads/sysdeps/pthread/timer_create.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/linuxthreads/sysdeps/pthread/timer_create.c b/linuxthreads/sysdeps/pthread/timer_create.c
index d6d756d2a6..cbefb91831 100644
--- a/linuxthreads/sysdeps/pthread/timer_create.c
+++ b/linuxthreads/sysdeps/pthread/timer_create.c
@@ -89,16 +89,33 @@ timer_create (clock_id, evp, timerid)
     case SIGEV_SIGNAL:
       /* We have a global thread for delivering timed signals.
 	 If it is not running, try to start it up.  */
-      if (! __timer_signal_thread.exists)
+      switch (clock_id)
 	{
-	  if (__builtin_expect (__timer_thread_start (&__timer_signal_thread),
+	case CLOCK_REALTIME:
+	default:
+	  thread = &__timer_signal_thread_rclk;
+	  break;
+#ifdef _POSIX_CPUTIME
+	case CLOCK_PROCESS_CPUTIME_ID:
+	  thread = &__timer_signal_thread_pclk;
+	  break;
+#endif
+#ifdef _POSIX_THREAD_CPUTIME
+	case CLOCK_THREAD_CPUTIME_ID:
+	  thread = &__timer_signal_thread_tclk;
+	  break;
+#endif
+	}
+      
+      if (! thread->exists)
+	{
+	  if (__builtin_expect (__timer_thread_start (thread),
 				1) < 0)
 	    {
 	      errno = EAGAIN;
 	      goto unlock_bail;
             }
         }
-      thread = &__timer_signal_thread;
       break;
 
     case SIGEV_THREAD:
@@ -112,11 +129,11 @@ timer_create (clock_id, evp, timerid)
       pthread_attr_setdetachstate (&newtimer->attr, PTHREAD_CREATE_DETACHED);
 
       /* Try to find existing thread having the right attributes.  */
-      thread = __timer_thread_find_matching (&newtimer->attr);
+      thread = __timer_thread_find_matching (&newtimer->attr, clock_id);
 
       /* If no existing thread has these attributes, try to allocate one.  */
       if (thread == NULL)
-	thread = __timer_thread_alloc (&newtimer->attr);
+	thread = __timer_thread_alloc (&newtimer->attr, clock_id);
 
       /* Out of luck; no threads are available.  */
       if (__builtin_expect (thread == NULL, 0))