about summary refs log tree commit diff
path: root/linuxthreads/sysdeps/pthread/timer_gettime.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-20 00:34:21 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-20 00:34:21 +0000
commitd2dfc5de011fb525161b85a1408f716a2ea358cc (patch)
tree22804aa59f348ac9d5bf432d2ddeb4c79ad31910 /linuxthreads/sysdeps/pthread/timer_gettime.c
parentd620426811688301eb1cbe6e63773d6430b2706e (diff)
downloadglibc-d2dfc5de011fb525161b85a1408f716a2ea358cc.tar.gz
glibc-d2dfc5de011fb525161b85a1408f716a2ea358cc.tar.xz
glibc-d2dfc5de011fb525161b85a1408f716a2ea358cc.zip
Update.
	* iconv/gconv_int.h (strict gconv_module): Remove all members
	associated with regular expressions.  Use a simple string as the
	from name.
	* iconv/gconv_db.c: Remove code handling regular expressions.
	* iconv/gconv_conf.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* iconv/gconv_builtin.h: Adjust for change in gconv_conf.c.
Diffstat (limited to 'linuxthreads/sysdeps/pthread/timer_gettime.c')
-rw-r--r--linuxthreads/sysdeps/pthread/timer_gettime.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/linuxthreads/sysdeps/pthread/timer_gettime.c b/linuxthreads/sysdeps/pthread/timer_gettime.c
index 43b07598b7..dbee9d915e 100644
--- a/linuxthreads/sysdeps/pthread/timer_gettime.c
+++ b/linuxthreads/sysdeps/pthread/timer_gettime.c
@@ -31,25 +31,30 @@ timer_gettime (timerid, value)
      struct itimerspec *value;
 {
   struct timer_node *timer;
-  struct timespec now;
-  int retval = -1;
+  struct timespec now, expiry;
+  int retval = -1, armed = 0, valid;
+  clock_t clock = 0;
 
   pthread_mutex_lock (&__timer_mutex);
 
   timer = timer_id2ptr (timerid);
-  if (timer == NULL && !timer->inuse)
-    /* Invalid timer ID or the timer is not in use.  */
-    errno = EINVAL;
-  else
-    {
-      value->it_interval = timer->value.it_interval;
+  valid = timer_valid (timer);
+
+  if (valid) {
+    armed = timer->armed;
+    expiry = timer->expirytime;
+    clock = timer->clock;
+    value->it_interval = timer->value.it_interval;
+  }
+
+  pthread_mutex_unlock (&__timer_mutex);
 
-      if (timer->armed)
+  if (valid)
+    {
+      if (armed)
 	{
-	  pthread_mutex_unlock (&__timer_mutex);
-	  clock_gettime (timer->clock, &now);
-	  pthread_mutex_lock (&__timer_mutex);
-	  timespec_sub (&value->it_value, &timer->expirytime, &now);
+	  clock_gettime (clock, &now);
+	  timespec_sub (&value->it_value, &expiry, &now);
 	}
       else
 	{
@@ -59,8 +64,8 @@ timer_gettime (timerid, value)
 
       retval = 0;
     }
-
-  pthread_mutex_lock (&__timer_mutex);
+  else
+    __set_errno (EINVAL);
 
   return retval;
 }