[Patches] [ python-Patches-533681 ] Apply semaphore code to Cygwin

noreply@sourceforge.net noreply@sourceforge.net
Fri, 22 Mar 2002 13:18:41 -0800


Patches item #533681, was opened at 2002-03-22 17:20
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=533681&group_id=5470

Category: Core (C code)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerald S. Williams (gsw_agere)
Assigned to: Nobody/Anonymous (nobody)
Summary: Apply semaphore code to Cygwin

Initial Comment:
The current version of Cygwin does not define 
_POSIX_SEMAPHORES by default, although requires the 
new semaphore interface since its condition variables 
interface contains a race condition.

This patch simply specifies that semaphores should be 
used if _POSIX_SEMAPHORES OR __CYGWIN__ is defined.


----------------------------------------------------------------------

>Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-03-22 21:18

Message:
Logged In: YES 
user_id=329402

Before _POSIX_SEMAPHORES is specified by default for 
Cygwin, it will probably have to be shown that it is 100% 
compliant with POSIX. Whether or not this is the case, the 
POSIX semaphore implementation is the one that should be 
used for Cygwin (it has been verified and approved by the 
Cygwin Python maintainer, etc.).

Prior to this, threading had been disabled for Cygwin 
Python, so this is really more of a port-to-Cygwin than a 
workaround. This could have been implemented in a new file 
(thread_cygwin.h), although during implementation it was 
discovered that the change for Cygwin would also benefit 
POSIX semaphore users in general.

The threading module overall is highly platform-specific, 
especially with regard to redefining POSIX symbols for 
specific platforms. In particular, this is done for the 
following platforms:
 __DGUX
 __sgi
 __ksr__
 anything using SOLARIS_THREADS
 __MWERKS__

However, except for those using SOLARIS_THREADS, these are 
specified in thread.c. I will therefore resubmit the patch 
as a change to thread.c instead.

The reference to __rtems__ actually comes from newlib, 
which Cygwin uses. It doesn't apply to Cygwin.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-22 20:03

Message:
Logged In: YES 
user_id=21627

-1. Cygwin really ought to define _POSIX_SEMAPHORES if they
support them, so if they support them and don't define the
feature test macro, it is a Cygwin bug. Work-arounds around
platform bugs are generally discourgaged in Python.

On python-dev, you indicate that _POSIX_SEMPAPHORES is only
defined if __rtems__ is also defined. What is the rationale
for that?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=533681&group_id=5470