X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Mark Hadfield Subject: Pthread.h issue Date: Wed, 12 Jul 2006 10:39:23 +1200 Lines: 45 Message-ID: <44B4289B.1040105@niwa.co.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Uwe Schulzweida User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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" m DOT hadfield AT niwa DOT co DOT nz 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/