summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_private.h
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-06-14 17:17:41 +0000
committerjasone <jasone@FreeBSD.org>2000-06-14 17:17:41 +0000
commit9f479e9f39861a77981b3e6234e796caa25cfe0f (patch)
tree25b4c819ee7794359e6c426e91cd15c2c56a2f49 /lib/libpthread/thread/thr_private.h
parentcc22f14b179a55f7686e798febd938bfef76c982 (diff)
downloadFreeBSD-src-9f479e9f39861a77981b3e6234e796caa25cfe0f.zip
FreeBSD-src-9f479e9f39861a77981b3e6234e796caa25cfe0f.tar.gz
pthread_mutex_lock(), pthread_cond_trywait(), and pthread_cond_wait() are
not allowed to return EINTR, but use of pthread_suspend_np() could cause EINTR to be returned. To fix this, restructure pthread_suspend_np() so that it does not interrupt a thread that is waiting on a mutex or condition, and keep enough state around that pthread_resume_np() can fix things up afterwards. Reviewed by: deischen
Diffstat (limited to 'lib/libpthread/thread/thr_private.h')
-rw-r--r--lib/libpthread/thread/thr_private.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index a86cfc6..6b48f23 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/thread/thr_private.h
@@ -350,6 +350,17 @@ struct pthread_attr {
#define PTHREAD_CREATE_SUSPENDED 1
/*
+ * Additional state for a thread suspended with pthread_suspend_np().
+ */
+enum pthread_susp {
+ SUSP_NO, /* Not suspended. */
+ SUSP_YES, /* Suspended. */
+ SUSP_NOWAIT, /* Suspended, was in a mutex or condition queue. */
+ SUSP_MUTEX_WAIT,/* Suspended, still in a mutex queue. */
+ SUSP_COND_WAIT /* Suspended, still in a condition queue. */
+};
+
+/*
* Miscellaneous definitions.
*/
#define PTHREAD_STACK_DEFAULT 65536
@@ -577,7 +588,7 @@ struct pthread {
#define PTHREAD_CANCEL_NEEDED 0x0010
int cancelflags;
- int suspended;
+ enum pthread_susp suspended;
thread_continuation_t continuation;
OpenPOWER on IntegriCloud