summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-08-30 15:51:41 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-08-30 15:51:41 +0000
commit72b7f4212f16326c465dcace478b2d679ea4e507 (patch)
tree705d8886a8dc2efc39c2e13f6ce21a6cfe91795e
parent0b9692b6f3d8cd44b73b81bc634931c8ed0f0ebe (diff)
(condition_implies, condition_unimplies): New functions.
(struct condition): New member `implications'. (cond_imp): New structure. (cond_signal): Return int now. (condition_broadcast): Always call cond_broadcast if this condition has implications. (condition_signal): Always call cond_signal if this condition has implications.
-rw-r--r--libthreads/cthreads.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/libthreads/cthreads.h b/libthreads/cthreads.h
index 08394ae5..38d88545 100644
--- a/libthreads/cthreads.h
+++ b/libthreads/cthreads.h
@@ -26,6 +26,9 @@
/*
* HISTORY
* $Log: cthreads.h,v $
+ * Revision 1.8 1995/08/30 15:10:23 mib
+ * (hurd_condition_wait): Provide declaration.
+ *
* Revision 1.7 1995/07/18 17:15:51 mib
* Reverse previous change.
*
@@ -374,8 +377,15 @@ typedef struct condition {
spin_lock_t lock;
struct cthread_queue queue;
char *name;
+ struct cond_imp *implications;
} *condition_t;
+struct cond_imp
+{
+ struct condition *implicatand;
+ struct cond_imp *next;
+};
+
#define CONDITION_INITIALIZER { SPIN_LOCK_INITIALIZER, QUEUE_INITIALIZER, 0 }
#define condition_alloc() ((condition_t) calloc(1, sizeof(struct condition)))
@@ -399,19 +409,19 @@ typedef struct condition {
#define condition_signal(c) \
MACRO_BEGIN \
- if ((c)->queue.head) { \
+ if ((c)->queue.head || (c)->implications) { \
cond_signal(c); \
} \
MACRO_END
#define condition_broadcast(c) \
MACRO_BEGIN \
- if ((c)->queue.head) { \
+ if ((c)->queue.head || (c)->implications) { \
cond_broadcast(c); \
} \
MACRO_END
-extern void
+extern int
cond_signal C_ARG_DECLS((condition_t c));
extern void
@@ -423,6 +433,12 @@ condition_wait C_ARG_DECLS((condition_t c, mutex_t m));
extern int
hurd_condition_wait C_ARG_DECLS((condition_t c, mutex_t m));
+extern void
+condition_implies C_ARG_DECLS((condition_t implicator, condition_t implicatand));
+
+extern void
+condition_unimplies C_ARG_DECLS((condition_t implicator, condition_t implicatand));
+
/*
* Threads.
*/