From 72b7f4212f16326c465dcace478b2d679ea4e507 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Wed, 30 Aug 1995 15:51:41 +0000 Subject: (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. --- libthreads/cthreads.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'libthreads') 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. */ -- cgit v1.2.3