summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-09-04 23:28:32 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-09-04 23:28:32 +0000
commit102264589c8731b5f0fb00b204e5963726ecec83 (patch)
tree06deffe11e700815387c28f79b669624b13cf368 /lib/libpthread/uthread
parenta362bd66e7c471788f1fab5627318b5a8749db41 (diff)
Use _waitq_remove() and _waitq_insert() always; from FreeBSD.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/pthread_private.h22
-rw-r--r--lib/libpthread/uthread/uthread_priority_queue.c10
2 files changed, 5 insertions, 27 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h
index f27e7703f88..1fbe0dce592 100644
--- a/lib/libpthread/uthread/pthread_private.h
+++ b/lib/libpthread/uthread/pthread_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pthread_private.h,v 1.28 2001/09/04 22:17:45 fgsch Exp $ */
+/* $OpenBSD: pthread_private.h,v 1.29 2001/09/04 23:28:31 fgsch Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -82,29 +82,13 @@
/*
* Waiting queue manipulation macros (using pqe link):
*/
-#if defined(_PTHREADS_INVARIANTS)
#define PTHREAD_WAITQ_REMOVE(thrd) _waitq_remove(thrd)
#define PTHREAD_WAITQ_INSERT(thrd) _waitq_insert(thrd)
+
+#if defined(_PTHREADS_INVARIANTS)
#define PTHREAD_WAITQ_CLEARACTIVE() _waitq_clearactive()
#define PTHREAD_WAITQ_SETACTIVE() _waitq_setactive()
#else
-#define PTHREAD_WAITQ_REMOVE(thrd) TAILQ_REMOVE(&_waitingq,thrd,pqe)
-#define PTHREAD_WAITQ_INSERT(thrd) do { \
- if ((thrd)->wakeup_time.tv_sec == -1) \
- TAILQ_INSERT_TAIL(&_waitingq,thrd,pqe); \
- else { \
- pthread_t tid = TAILQ_FIRST(&_waitingq); \
- while ((tid != NULL) && (tid->wakeup_time.tv_sec != -1) && \
- ((tid->wakeup_time.tv_sec < (thrd)->wakeup_time.tv_sec) || \
- ((tid->wakeup_time.tv_sec == (thrd)->wakeup_time.tv_sec) && \
- (tid->wakeup_time.tv_nsec <= (thrd)->wakeup_time.tv_nsec)))) \
- tid = TAILQ_NEXT(tid, pqe); \
- if (tid == NULL) \
- TAILQ_INSERT_TAIL(&_waitingq,thrd,pqe); \
- else \
- TAILQ_INSERT_BEFORE(tid,thrd,pqe); \
- } \
-} while (0)
#define PTHREAD_WAITQ_CLEARACTIVE()
#define PTHREAD_WAITQ_SETACTIVE()
#endif
diff --git a/lib/libpthread/uthread/uthread_priority_queue.c b/lib/libpthread/uthread/uthread_priority_queue.c
index bb40d6fd934..918ff694aec 100644
--- a/lib/libpthread/uthread/uthread_priority_queue.c
+++ b/lib/libpthread/uthread/uthread_priority_queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_priority_queue.c,v 1.3 2000/01/06 07:20:23 d Exp $ */
+/* $OpenBSD: uthread_priority_queue.c,v 1.4 2001/09/04 23:28:31 fgsch Exp $ */
/*
* Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
* All rights reserved.
@@ -67,7 +67,7 @@ static int _pq_active = 0;
PANIC(msg); \
} while (0)
#define _PQ_ASSERT_NOT_QUEUED(thrd, msg) do { \
- if ((thrd)->flags & _PQ_IN_SCHEDQ) \
+ if (((thrd)->flags & _PQ_IN_SCHEDQ) != 0) \
PANIC(msg); \
} while (0)
@@ -80,11 +80,9 @@ static int _pq_active = 0;
#define _PQ_ASSERT_IN_WAITQ(thrd, msg)
#define _PQ_ASSERT_IN_PRIOQ(thrd, msg)
#define _PQ_ASSERT_NOT_QUEUED(thrd, msg)
-#define _PQ_CHECK_PRIO()
#endif
-
int
_pq_alloc(pq_queue_t *pq, int minprio, int maxprio)
{
@@ -102,9 +100,7 @@ _pq_alloc(pq_queue_t *pq, int minprio, int maxprio)
else {
/* Remember the queue size: */
pq->pq_size = prioslots;
-
ret = _pq_init(pq);
-
}
return (ret);
}
@@ -271,7 +267,6 @@ pq_insert_prio_list(pq_queue_t *pq, int prio)
pq->pq_lists[prio].pl_queued = 1;
}
-#if defined(_PTHREADS_INVARIANTS)
void
_waitq_insert(pthread_t pthread)
{
@@ -333,4 +328,3 @@ _waitq_clearactive(void)
_PQ_CLEAR_ACTIVE();
}
#endif
-#endif