about summary refs log tree commit diff
path: root/linuxthreads/sysdeps/pthread/posix-timer.h
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/posix-timer.h
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/posix-timer.h')
-rw-r--r--linuxthreads/sysdeps/pthread/posix-timer.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/linuxthreads/sysdeps/pthread/posix-timer.h b/linuxthreads/sysdeps/pthread/posix-timer.h
index feeff39fa8..7a2caf28a4 100644
--- a/linuxthreads/sysdeps/pthread/posix-timer.h
+++ b/linuxthreads/sysdeps/pthread/posix-timer.h
@@ -59,9 +59,12 @@ struct timer_node
   pthread_attr_t attr;
   unsigned int abstime;
   unsigned int armed;
-  unsigned int inuse;
+  enum {
+    TIMER_FREE, TIMER_INUSE, TIMER_DELETED
+  } inuse;
   struct thread_node *thread;
   pid_t creator_pid;
+  int refcount;
 };
 
 
@@ -106,6 +109,28 @@ timer_ptr2id (struct timer_node *timer)
   return timer - __timer_array;
 }
 
+/* Check whether timer is valid; global mutex must be held. */
+static inline int
+timer_valid (struct timer_node *timer)
+{
+  return timer && timer->inuse == TIMER_INUSE;
+}
+
+/* Timer refcount functions; need global mutex. */
+extern void __timer_dealloc (struct timer_node *timer);
+
+static inline void
+timer_addref (struct timer_node *timer)
+{
+  timer->refcount++;
+}
+
+static inline void
+timer_delref (struct timer_node *timer)
+{
+  if (--timer->refcount == 0)
+    __timer_dealloc (timer);
+}
 
 /* Timespec helper routines.  */
 static inline int
@@ -178,7 +203,6 @@ extern struct timer_node *__timer_alloc (void);
 extern int __timer_thread_start (struct thread_node *thread);
 extern struct thread_node *__timer_thread_find_matching (const pthread_attr_t *desired_attr, clockid_t);
 extern struct thread_node *__timer_thread_alloc (const pthread_attr_t *desired_attr, clockid_t);
-extern void __timer_dealloc (struct timer_node *timer);
 extern void __timer_thread_dealloc (struct thread_node *thread);
 extern int __timer_thread_queue_timer (struct thread_node *thread,
 				       struct timer_node *insert);