Subject: Pthread.h issue
From: Mark Hadfield <[email-masked]>
To: [email-masked]
Cc: Uwe Schulzweida <[email-masked]>
Date: Wed, 12 Jul 2006 10:39:23 +1200

I am trying to build version 1.0.0 of the CDO (Climate Data Operators) 
package:

   http://www.mpimet.mpg.de/fileadmin/software/cdo/
   http://www.mpimet.mpg.de/fileadmin/software/cdo/cdo-1.0.0.tar.gz

There is a problem with the pthread-related code. The problem can be 
worked around, but it seems to indicate a problem with some of the macro 
definitions in Cygwin's pthread.h.

To cut a long story short, the CDO source includes the following (file 
src/pthread_debug.c, function  print_pthread_mutexattr, lines 84-87):

#if defined (PTHREAD_PRIO_INHERIT)
   pthread_mutexattr_getprotocol(m_attr, &protocol);
   POUT3(caller, protocol, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT, 
PTHREAD_PRIO_NONE);
#endif

This expands to valid C code if and only if the macros 
PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT and PTHREAD_PRIO_NONE are 
defined to integer constants. But the definitions are empty 
(/usr/sys/sinclude/pthread.h, lines 63-65):

#define PTHREAD_PRIO_INHERIT
#define PTHREAD_PRIO_NONE
#define PTHREAD_PRIO_PROTECT

My work-around (apparently successful but the resulting executables have 
not been tested thoroughly) is to override the above with

#define PTHREAD_PRIO_INHERIT 1
#define PTHREAD_PRIO_NONE 1
#define PTHREAD_PRIO_PROTECT 1

So, why would Cygwin pthread have empty definitions for these macros? Is 
it safe to override the definitions? Would it be safer to omit the code 
that uses them on this platform?

-- 
Mark Hadfield          "Kei puwaha te tai nei, Hoea tahi tatou"
[email-masked]
National Institute for Water and Atmospheric Research (NIWA)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/