[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mach "cthreads.h" header file issue



Hmm.  Our definitions of mutex_init et al as macros are not new, they come
from the original CMU Mach 3.0 version of cthreads.  The code you are
dealing with must have been written for some OSF version of cthreads or
something.  

As a general rule, I am inclined to punt on these "cthreads portability"
things.  Eventually we will have pthreads, and until then things like stdio
are thread-safe anyway (actually, I think stdio is the only such thing).

But, try this patch to cthreads.h; it should harmlessly frob all those
macros that can't fail so they can be used as functions that return zero.


Index: cthreads.h
===================================================================
RCS file: /afs/sipb.mit.edu/project/hurddev/cvsroot/hurd/libthreads/cthreads.h,v
retrieving revision 1.14
diff -u -b -p -r1.14 cthreads.h
--- cthreads.h	1999/05/30 01:39:48	1.14
+++ cthreads.h	1999/05/30 19:09:51
@@ -246,12 +246,12 @@ typedef char *any_t;
 #define	FALSE	0
 #endif	/* TRUE */
 
-#ifndef MACRO_BEGIN
 
-#define	MACRO_BEGIN	do {
-#define	MACRO_END	} while (0)
+#undef	MACRO_BEGIN
+#undef	MACRO_END
+#define	MACRO_BEGIN	__extension__ ({
+#define	MACRO_END	0; })
 
-#endif	MACRO_BEGIN
 
 /*
  * C Threads package initialization.


Reply to: