Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/lib/libpthread Avoid including pthread_queue.h and ther...



details:   https://anonhg.NetBSD.org/src/rev/61adf57cecad
branches:  nathanw_sa
changeset: 505500:61adf57cecad
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Sun Dec 30 02:24:10 2001 +0000

description:
Avoid including pthread_queue.h and thereby exposing the PTQ_* macros
to userland, by #defining a local _PTQ_HEAD, identical to PTQ_HEAD in
pthread_queue.h, and using {NULL, NULL} in place of
PTQ_HEAD_INITIALIZER.

Rename struct pt_queue_t to struct pthread_queue_t.
Rename pt_spin_t to pthread_spin_t.

diffstat:

 lib/libpthread/pthread_types.h |  31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r 76b9abe40429 -r 61adf57cecad lib/libpthread/pthread_types.h
--- a/lib/libpthread/pthread_types.h    Sun Dec 30 02:21:18 2001 +0000
+++ b/lib/libpthread/pthread_types.h    Sun Dec 30 02:24:10 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_types.h,v 1.1.2.6 2001/08/08 16:31:22 nathanw Exp $    */
+/*     $NetBSD: pthread_types.h,v 1.1.2.7 2001/12/30 02:24:10 nathanw Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -40,11 +40,20 @@
 #define _LIB_PTHREAD_TYPES_H
 
 #include <machine/lock.h>
-#include "pthread_queue.h"
+
+typedef __cpu_simple_lock_t    pthread_spin_t;
+
 
-typedef __cpu_simple_lock_t    pt_spin_t;
+/*
+ * Copied from PTQ_HEAD in pthread_queue.h
+ */
+#define _PTQ_HEAD(name, type)                                  \
+struct name {                                                          \
+       struct type *ptqh_first;/* first element */                     \
+       struct type **ptqh_last;/* addr of last next element */         \
+}
 
-PTQ_HEAD(pt_queue_t, pthread_st);
+_PTQ_HEAD(pthread_queue_t, pthread_st);
 
 struct pthread_st;
 struct pthread_attr_st;
@@ -78,12 +87,12 @@
         * Open research question: Would it help threaded applications if
         * preempted-lock-continuation were applied to mutexes?
         */
-       pt_spin_t       ptm_lock; 
+       pthread_spin_t  ptm_lock; 
 
        /* Protects the owner and blocked queue */
-       pt_spin_t       ptm_interlock;
+       pthread_spin_t  ptm_interlock;
        pthread_t       ptm_owner;
-       struct pt_queue_t       ptm_blocked;
+       struct pthread_queue_t  ptm_blocked;
 };
 
 #define        _PT_MUTEX_MAGIC 0x33330003
@@ -93,7 +102,7 @@
                                    __SIMPLELOCK_UNLOCKED,              \
                                    __SIMPLELOCK_UNLOCKED,              \
                                    NULL,                               \
-                                   PTQ_HEAD_INITIALIZER                \
+                                   {NULL, NULL}                        \
                                  }
        
 
@@ -109,8 +118,8 @@
        unsigned int    ptc_magic;
 
        /* Protects the queue of waiters */
-       pt_spin_t       ptc_lock;
-       struct pt_queue_t       ptc_waiters;
+       pthread_spin_t  ptc_lock;
+       struct pthread_queue_t  ptc_waiters;
 
        pthread_mutex_t *ptc_mutex;     /* Current mutex */
 };
@@ -120,7 +129,7 @@
 
 #define PTHREAD_COND_INITIALIZER { _PT_COND_MAGIC,                     \
                                   __SIMPLELOCK_UNLOCKED,               \
-                                  PTQ_HEAD_INITIALIZER,                \
+                                  {NULL, NULL},                        \
                                   NULL                                 \
                                 }
 



Home | Main Index | Thread Index | Old Index