summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2004-09-18 19:57:36 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2004-09-18 19:57:36 +0000
commit6b75e289325ab12e31ac956a08d9d3a80ff41ef5 (patch)
treedd62766612c4a4006e62056e805e749a78dc0d79 /lib/libpthread
parent379efe054b7037b83749a3d20a1ebc1ae7ae0e80 (diff)
Allow thread in FD{R,W}_WAIT states to be suspended.
Patch from Kurt Miller <truk at optonline.net> Commit reminder from millert@. OK brad@
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/uthread/uthread_suspend_np.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_suspend_np.c b/lib/libpthread/uthread/uthread_suspend_np.c
index 6d75bb0198b..2caca0030df 100644
--- a/lib/libpthread/uthread/uthread_suspend_np.c
+++ b/lib/libpthread/uthread/uthread_suspend_np.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_suspend_np.c,v 1.8 2004/05/01 22:15:10 marc Exp $ */
+/* $OpenBSD: uthread_suspend_np.c,v 1.9 2004/09/18 19:57:35 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -106,9 +106,19 @@ suspend_common(struct pthread *thread)
PTHREAD_SET_STATE(thread, PS_SUSPENDED);
break;
- case PS_SPINBLOCK:
case PS_FDR_WAIT:
case PS_FDW_WAIT:
+ /*
+ * Remove these threads from the work queue
+ * and set the state to suspended:
+ */
+ if ((thread->flags & PTHREAD_FLAGS_IN_WORKQ) != 0)
+ PTHREAD_WORKQ_REMOVE(thread);
+ PTHREAD_WAITQ_REMOVE(thread);
+ PTHREAD_SET_STATE(thread, PS_SUSPENDED);
+ break;
+
+ case PS_SPINBLOCK:
case PS_POLL_WAIT:
case PS_SELECT_WAIT:
/*