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

noreply@sourceforge.net noreply@sourceforge.net
Sun, 24 Mar 2002 22:42:34 -0800


Patches item #533681, was opened at 2002-03-22 12: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: Closed
>Resolution: Rejected
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: Tim Peters (tim_one)
Date: 2002-03-25 01:42

Message:
Logged In: YES 
user_id=31435

I'm rejecting the patch based on Jason Tishler's comments 
in:

http://mail.python.org/pipermail/python-dev/2002-
March/021675.html

Please work with Jason to find a better solution.  If you 
and Jason can't find a better one, and Jason goes along 
with this patch, we can reopen it.

In the meantime, you motivated me to get rid of the old 
__ksr__ cruft <wink>.

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

Comment By: Tim Peters (tim_one)
Date: 2002-03-22 16:28

Message:
Logged In: YES 
user_id=31435

I'm afraid I agree with Martin here:  the crusty old 
historical examples you dug up are exactly why we avoid 
doing similar stuff now.  Nobody understands why that code 
is there anymore, and it will never go away.  For example, 
I happen to know that KSR went bankrupt in 1994, and 
anything keying off __ksr__ has been worse than useless 
since then.

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

Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-03-22 16:19

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: Gerald S. Williams (gsw_agere)
Date: 2002-03-22 16: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 15: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