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

Mach "cthreads.h" header file issue



Roland,

While working on Python, I discovered that the GNU implementation of mutex_locK() is
not compatible with Python's cthread support.  I modified the Python sources to get
it to compile, but thought I'd at least pass this your way for consideration.

The problem is with the use of a #define for mutex_init:

(From /include/cthreads.h)
#define mutex_init(m) \
	MACRO_BEGIN
	spin_lock_init(&(m)->lock); \
	cthread_queue_init(&(m)->queue); \
	spin_lock_init(&(m)->held); \
	MACRO_END

Python uses this call in an "if" construct, expecting it to return a value.
(From [python]/Python/thread_cthread.h)
if (mutex_init(lock)) {
	// Do error handling ....
}


Should this be modified (perhaps as an inline function) to cause a return
value on error?

Thanks,

-Brent





Reply to: